-
Notifications
You must be signed in to change notification settings - Fork 550
Description
I am trying to define 3-tuple data with the set_array format. The data is taken from an excel file.
My code:
from pyomo.environ import *
model = ConcreteModel()
model.A = Set([A1,A2,A3])
model.B = Set([B1, B2, B3])
model.C = Set([C1, C2, C3])
model.D = Set(model.A, model.B, model.C)
data = DataPortal()
data.load(filename='excel.xlsx', range='set3', format='set_array', set='D')
Excel table (excel.xlsx, range=set3)
B C A1 A2 A3
B1 C1 + - +
B2 C2 - - +
B3 C3 + + +
the problem is that the code is generating a 2-tuple set instead of a 3-tuple. The result I am obtaining is:
D =[(A1, B1), (A3, B1), (A3, B2), (A1, B3), (A2, B3), (A3, B3)]
What I would like:
D =[(A1, B1, C1), (A3, B1, C1), (A3, B2, C2), (A1, B3, C3), (A2, B3, C3), (A3, B3, C3)]
Any suggestion and/or recommendations would be very much appreciated. Many thanks in advance!