Originally posted by: SystemAdmin
Thank you for your response here, Philippe! Actually I generate expressions individually for objective function in different steps according to particular patterns in a decision tree in my model. Afterward I sum up these expressions to construct the final expression. So I use IloLinearNumExpr to more easily build up linear expressions in loops. For instance,
IloLinearNumExpr e1,e2,e3
e1.addTerm(5, X[0]);
e1.addTerm(3, X[1]);
e1.addTerm(7, X[2]);
e1.setConstant(10);
e2.addTerm(10, X[6]);
....
e2.addTerm(n, X
20);
IloNumExpr e3 = model.min(e1,e2);
...
...
en
and the final expression is the summation of all expressions: F = e1+e2+...+en
what is really needed to build up the final expression is casting IloNumExpr expressions (e.g., e3) to IloLinearNumExpr in the course of iteration to be able to create the final expression in a loop. However, the casting is not plausible. So I'm wondering how we can deal with it!
#ConstraintProgramming-General#DecisionOptimization