Output functions and error handling
Most Java modeling objects have methods to query their attributes. For example, variable names and lower and upper bounds can be printed by using the getName, getLB, and getUB methods, respectively. This line prints the name of a variable and its bounds:
System.out.println(String.format("%s: [%s,%s]", frac[2].getName(), frac[2].getLB(), frac[2].getUB()));
The output is as follows:
frac2: [0.0,0.3]
After the problem has been solved its solution value can be printed using frac[2].getSolution():
frac2: 0.2
To create an object-oriented problem, an instance of the XpressProblem class is needed. Since an instance of XpressProblem wraps native resources, it is good practice to release these resources as soon as the object is no longer needed by using try-with-resources:
try (XpressProblem prob = new XpressProblem("Folio")) { ... }
Problem attributes can be used to query the solution or solve statuses of the problem, by using getSolveStatus and getSolStatus , respectively.
System.out.println(String.format("Problem status:%n\tSolve status: %s%n\tSol status: %s", prob.attributes().getSolveStatus(), prob.attributes().getSolStatus()));The method getSolStatus may be used to check the solution status. Only if the problem has been solved successfully Xpress will return or print out meaningful solution values.
© 2001-2025 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.