If you write
IloExpr b = a + 0;
then b should be a deep copy of a. This code
IloEnv env;
IloNumVar x(env, 0, 1, "x");
IloNumVar y(env, 0, 1, "y");
IloNumVar z(env, 0, 1, "z");
IloExpr a = x + y;
IloExpr b = a + 0;
std::cout << a << std::endl;
std::cout << b << std::endl;
b += z;
std::cout << a << std::endl;
std::cout << b << std::endl;
prints
x + y
x + y
x + y
x + y + z
------------------------------
Daniel Junglas
------------------------------
Original Message:
Sent: Tue June 02, 2020 11:01 AM
From: Serge Bisaillon
Subject: copy of IloExpr
Hi!
I would like to use an existing IloExpr to create new expressions which looks quite the same but have little changes in it.
I would like to know how to make a deep copy of the existing IloExpr because I don't want to create the new ones from scratch but just adding some elements to it.
Thanks
------------------------------
Serge Bisaillon
------------------------------
#DecisionOptimization