Originally posted by: SystemAdmin
>
> my program compile Ok,but it can't run.it said memoty can't be written.
> part of my progarm as follow:
> {IloExprArray e2(env);
> e2[0]+=9;}
>
> I setted a breakpoint just after e2[0]+=9;when it run,it said memoty can't be written.
> I guess wy program is error in {IloExprArray e2(env);e2[0]+=9;}
You are trying to add something to a nonexistent array entry (e2[0]). Creating the array does not create any entries. You first need to use e2.add(...) to create e2[0]; then you can add to it.
> I hope to get some examples about the use of "IloExprArray".
CPLEX comes with several directories of examples. In the .../cpp folder, look for iloaddmipex5.cpp or ilogoalex2.cpp.
/Paul
Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
#CPLEXOptimizers#DecisionOptimization