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.
© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation ("FICO"). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.
