# consider negative value in cplex

 0 Hi I am using java with cplex I am trying to maximize an equation and i want to consider the object even if it is a negative value. I declared about my object variable like that IloNumVar profit = cplex.numVar(0, Double.MAX_VALUE, "profit");  when i use this code the object value will be zero because it is negative Do you have any suggestion to do that ? asked 27 Oct '14, 06:50 ibrahem 3●5 accept rate: 0%

 2 You should not put a lower bound of zero on your variable if you want it to take negative values as well. I don't know the java-API but I could imagine it should look something like IloNumVar profit = cplex.numVar(-IloInfinity, IloInfinity, "profit");  answered 27 Oct '14, 08:51 Sune 958●4●14 accept rate: 20% Thank you very much (27 Oct '14, 09:00) ibrahem 2 In the Java API, the way to represent infinity (signed) is Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY. (28 Oct '14, 16:24) Paul Rubin ♦♦
 toggle preview community wiki

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

Tags:

×191
×7

Seen: 1,316 times

Last updated: 28 Oct '14, 16:24