I'm building a model and I keep getting an error that my Param is failing because it takes 3 positional arguments, but 4 were given. I can't figure out how to fix this.
from pyomo.environ import *
model = ConcreteModel()
model.x = Set(initialize=['apple', 'orange', 'pineapple', 'jelly', 'broccoli'])
model.y = Set(initialize=[('1','2'), ('1','3'), ('2','1'), ('2','3'), ('3','1'), ('3','2')])
model.testing = Var(model.x, model.y, bounds=(0,100), within=NonNegativeIntegers)
fruit = {
('1','2'): {'apple': 7,'orange': 13,'pineapple': 30, 'jelly': 17,'broccoli': 20},
('1','3'): {'apple': 8, 'orange': 14, 'pineapple': 30, 'jelly': 16, 'broccoli': 21},
('2','1'): {'apple': 9, 'orange': 15, 'pineapple': 31, 'jelly': 15, 'broccoli': 22},
('2','3'): {'apple': 10, 'orange': 16, 'pineapple': 31, 'jelly': 14, 'broccoli': 23},
('3','1'): {'apple': 11, 'orange': 17, 'pineapple': 31, 'jelly': 12, 'broccoli': 23},
('3','2'): {'apple': 12, 'orange': 18, 'pineapple': 31, 'jelly': 13, 'broccoli': 24}
}
model.fruittesting = Param(model.y, model.x, initialize=lambda model, xx, yy: fruit[y][x], within=NonNegativeIntegers)
ERROR: Rule failed for Param 'fruittesting' with index ('1', '2', 'apple'):
TypeError: <lambda>() takes 3 positional arguments but 4 were given
ERROR: Constructing component 'fruittesting' from data=None failed:
TypeError: <lambda>() takes 3 positional arguments but 4 were given