Output functions and error handling
Most BCL modeling objects (XPRBprob, XPRBvar, XPRBctr, XPRBsos, and XPRBindexSet) have a method print. For variables, depending on where the method is invoked either their bounds or their solution value is printed: adding the line
frac[2].print();
before the call to the optimization will print the name of the variable and its bounds,
frac2: [0,0.3]
whereas after the problem has been solved its solution value gets displayed:
frac2: 0.2
Whenever BCL detects an error it stops the program execution with an error message so that it will usually not be necessary to test the return value of every operation. If a BCL program is embedded into some larger application, it may be helpful to use the explicit initialization to check early on that the software can be accessed correctly, for instance:
if(XPRB::init() != 0) { cout << "Initialization failed." << endl; return 1; }
The method getLPStat may be used to test the LP problem status. Only if the LP problem has been solved successfully BCL will return or print out meaningful solution values:
char *LPSTATUS[] = {"not loaded", "optimal", "infeasible", "worse than cutoff", "unfinished", "unbounded", "cutoff in dual", "unsolved", "nonconvex"}; cout << "Problem status: " << LPSTATUS[p.getLPStat()] << endl;
© 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.