Initializing help system before first use

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;