Originally posted by: zoldfish
>
> I think it is your fault. The problem is this:
>
> IloExpr expr(env);
> expr = x;
>
> The first line creates a new IloExprI instance and makes expr a reference to that.
> The second line makes expr reference the same expression that is referenced by x, thereby dropping the reference to the IloExprI instance created in the first line.
> There are three versions to do things correctly:
>
> // Version 1
> IloExpr expr = x;
>
> // Version 2
> IloExpr expr;
> expr = x;
>
> // Version 3
> IloExpr expr(env);
> expr += x;
>
Thanks a lot, that really works. My understanding about CPLEX needs to be corrected...
However when I am using IloRangeArray instance additionally, another similar problem comes out. I post a new thread
Here . I will appreciate much if you can help me again there~thanks!
#CPLEXOptimizers#DecisionOptimization