Displaying high precision nonzero values of a solution¶
Offers an example of a function to display nonzero values of a solution at high precision in Python.
The Python API of CPLEX also supports display at high precision of nonzero values in a solution. To take advantage of this feature in your Python applications of CPLEX, you can define your own function, like this:
>>> def display_solution_nonzero_values_highprecision(c):
... for i, x in enumerate(c.solution.get_values()):
... if (x!=0):
... print "Solution value of ",c.variables.get_names(i),\
... " is ", " %+18.16e" % x
...
>>> display_solution_nonzero_values_highprecision(c)
Solution value of Open(1) is +1.0000000000000000e+000
Solution value of Open(2) is +1.0000000000000000e+000
Solution value of Open(3) is +1.7865900324417692e+002...