Interpreting the output of cplex - variable names and precision.

 0 1 Two questions about the output that Cplex generates (I am seeing this in the intermediate solution files, e.g. pref-00001.sol): A. Cplex renames variables, and I need to know if this is avoidable, and what is the meaning of this. so, for example "a1" became "a1#0" in the output file, and "Ex_094141_A" became "_Ex_094141_A#40" (note the additional '_' in the beginning.) Are these the original variables, renamed, or something else ? B. I am getting as part of the output a value e.g., "5.999999999..." for a variables that is defined as an integer. This upsets my post-processing of the solution. Any remedy ? asked 17 Aug '17, 23:16 ofer 11●2 accept rate: 0%

 2 A. I seem to remember that cplex only modifies the names of your variables if some variable names in your model have special characters in it. E.g. myVar.setName("c_1,3") (this variable name has a comma). Try renaming your variables, thereby making sure that none of them have any special characters. B. This you cannot fix. By specifying that a variable is an integer variable, you ensure that cplex solves the model as a MIP instead of an LP. However, for its computations, cplex must obviously rely on fractional values. Consequently, cplex stores all variable values as doubles. So when you invoke cplex.getValue(myVar), the result is again a double. Consider using the following method to convert doubles to integers. public static int doubleToInt(double value) { int result = (int)Math.round(value); if(Math.abs(value - (double)result) < config.PRECISION) return result; else throw new RuntimeException("Failed to round double, not near an integer value: " + value); }  answered 18 Aug '17, 05:50 Joris Kinable 338●1●2●13 accept rate: 16% CPLEX has no objection to underscores in a name. Most other symbols/punctuation marks result in the "#..." appendix in model and solution files, where I think (but am not sure) that the digits (...) are the index of the variable in a master list of variables. (The same also applies to constraint names.) (18 Aug '17, 13:50) 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