In OPL for input set we are defining as given below:
tuple Damage_line_Nodes {
int value;
};
// Declare a set with a few tuples
{Damage_line_Nodes} Damage_line_Node = ...;
In python (we are trying to give the input to the OPL model using python code given below)
from doopl.factory import create_opl_model
# Data
Damage_Nodes = [
{8, 9, 12, 6, 19, 23, 24, 27, 30}
]
my_set_list = list(Damage_Nodes)
model_path = "C:/Users/VCGA/opl/MEG/MEG.mod"
with create_opl_model(model=model_path) as opl:
opl.set_input("Damage_line_Node", Damage_Nodes)
opl.set_input('Damage_line_Node',my_set_list)
opl.run()
Here's a explanation of the error we encountered -
*** ERROR[GENERATE_001] at 795:25-42 C:/Users/VCGA/opl/MEG/MEG.mod: Cannot use type <value:int> for int.
*** ERROR[GENERATE_001] at 828:2-19 C:/Users/VCGA/opl/MEG/MEG.mod: Cannot use type <value:int> for int.
*** ERROR[GENERATE_001] at 837:2-19 C:/Users/VCGA/opl/MEG/MEG.mod: Cannot use type <value:int> for int.
Fatal Python error: Aborted
The error messages we are encountering indicate that there's a type mismatch in the OPL model between what is expected and what is being provided. Specifically, the OPL model is not accepting the type value:int as a valid type for int. Suggest that I use both OPL and Python to feed input to the OPL model using Python.