problem.getSolution
problem.getSolution |
Purpose
Returns the solution to an optimization problem if called after the
solve() function has terminated. This function works with both continuous and mixed-integer optimization problems.
Synopsis
x = problem.getSolution (indices = None)
Argument
indices
|
(optional) specify indices, datas, or names of the object whose solution is requested
|
Example
y=xpress.var(name='var1') x=xpress.var(name='var2') [...] p.solve () print ("solution:", p.getSolution ()) print ("x is", p.getSolution (x)) print ("first four var:", p.getSolution ([:4])) print ("x and y are", p.getSolution (['var1', 'var2']))
Further information
For efficiency reasons it is preferable that one call to
getSolution is made, as the whole vector is obtained at each call and only the desired portion is returned.
Related topics
problem.getlpsol,
problem.getmipsol,
problem.getDual,
problem.getSlack,
problem.getRCost,
problem.getProbStatus,
problem.getProbStatusString.