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
This topic has been locked.
3 replies
Latest Post
 20130221T14:42:06Z by SystemAdmin
ACCEPTED ANSWER
Pinned topic sutracting number from IloNumExpr java cplex
20130221T14:01:32Z

Answered question
This question has been answered.
Unanswered question
This question has not been answered yet.
Updated on 20130221T14:42:06Z at 20130221T14:42:06Z by SystemAdmin

ACCEPTED ANSWER
Re: sutracting number from IloNumExpr java cplex
20130221T14:16:45Z in response to SystemAdminYou need to use the setConstant() member function to change the constant part of an expression.
ACCEPTED ANSWER
Re: sutracting number from IloNumExpr java cplex
20130221T14:28:51Z in response to SystemAdminThanks, 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] \}?
ACCEPTED ANSWER
Re: sutracting number from IloNumExpr java cplex
20130221T14:42:06Z in response to SystemAdminI suggest you take a good look at the IloCplexModeler class reference documentation. That is the superclass of IloCplex that provides the modeling API.
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

