Hello! What I want to do is to subtract an IloNumExpr from a number. I want to put to an expression the following thing:
\{
for i
for j
for k
n(nk1)*y[i][j]
\}
n is an integer and y is a decision variable
Cplex does not let me subtract a number in the addTerm method of the expression.
Topic

Re: sutracting number from IloNumExpr java cplex
20130221T14:28:51ZThis is the accepted answer. This is the accepted answer. SystemAdmin
 20130221T14:16:45Z
You need to use the setConstant() member function to change the constant part of an expression. 
Re: sutracting number from IloNumExpr java cplex
20130221T14:42:06ZThis is the accepted answer. This is the accepted answer. SystemAdmin
 20130221T14:28:51Z
Thanks, Daniel. But then how will I subtract the expression from this constant part. I will say \{setConstant(n) \} and how will I say the \{ (nk+1)y[i][j] \}?
There you can find for example member function
IloNumExpr sum(double v, IloNumExpr e1);
that produces the sum of a constant and an expression.Updated on 20140324T22:39:33Z at 20140324T22:39:33Z by ironman