Originally posted by: AndyHam
Dear IBM,
I am trying to add an OplDataElement. When I tried a single integer variable for OplDataElement, it worked great. But, when I tried a tuple, it generates the following error: "Cannot use type string for …". Would you please see if how we can make the following illustration code work?
//Test_Sub.mod
tuple t_A2B {
key int a;
key int b;
} {t_A2B} A2B=...;
dexpr int Makespan = sum(ab in A2B) ab.a*ab.b;
minimize Makespan;
subject to {};
//main.mod
main {
var source = new IloOplModelSource("Test_Sub.mod");
var def = new IloOplModelDefinition(source);
var opl = new IloOplModel(def,cplex);
var data= new IloOplDataElements();
data.A2B= "{<1 1> <2 4>}";
opl.addDataSource(data);
opl.generate();
cplex.solve();
}
#DecisionOptimization#OPLusingCPOptimizer