Initializing help system before first use

XPRB

Description
Initialization and general settings.
Methods
Get the running time.
Get the version number of BCL.
Initialize BCL.
Set a column ordering criterion for matrix generation.
Set the message print level.
Set the format for printing real numbers.

Method detail

getTime
Synopsis
int getTime();
Return value
System time measure in milliseconds.
Description
This methods returns the system time measure in milliseconds. The absolute value is system-dependent. To measure the execution time of a program, this methods can be used to calculate the difference between the start time and the time at the desired point in the program.
Example
This example shows how to measure the elapsed time in a BCL program:
int starttime;
XPRB::init();
starttime = XPRB::getTime();
 ...
cout << "Time: " << (XPRB::getTime()-starttime)/1000;
cout << " sec" << endl; 
Related topics
Calls XPRBgettime

getVersion
Synopsis
const char *getVersion();
Return value
BCL version number if function executed successfully, NULL otherwise.
Description
The version number returned by this method is required if the user is reporting a problem.
Example
The following example retrieves and prints out the BCL version number:
const char *version;
XPRB::init();
version = XPRB::getVersion();
cout << "Xpress BCL version " << version << endl; 
Related topics

init
Synopsis
int init();
Return value
0 if initialization executed successfully, 1 otherwise.
Description
This method explicitly initializes BCL, that is it tests whether a license for running this software is available. Without this explicit initialization the initialization will be performed at the creation of the first problem (see XPRBprob). There is no need to call this explicit initialization unless you wish to separate the license check from problem creation or perform some general settings before creating any problem. This method also initializes Xpress Optimizer. In applications that create a large number of problems it is recommended to use the explicit initialization—once only per process for highest efficiency.
Example
This example shows how to initialize BCL explicitly before creating a problem.
 XPRBprob *prob;

 if (XPRB::init())
 { cout << "Initialization failed" << endl; return 1; }
 prob = new XPRBprob("myprob"); 
Related topics
Calls XPRBinit

setColOrder
Synopsis
int setColOrder(int num);
Argument
num 
The ordering flag, which must be one of:
default ordering;
alphabetical order.
Return value
0 if method executed successfully, 1 otherwise.
Description
1. BCL runs reproduce always the same matrix for a problem. This method allows the user to choose a different ordering criterion than the default one. Note that this method only changes the order of columns in what is sent to Xpress Optimizer, you do not see any effect when exporting the matrix with BCL. However you can control the effect by exporting the matrix from the Optimizer.
2. The setting applies to all problems that are created subsequently. It is also possible to change the setting for a particular problem (see XPRBprob).
Related topics

setMsgLevel
Synopsis
int setMsgLevel(int lev);
Argument
level 
The message level, i.e. the type of messages printed by BCL. This may be one of:
no messages printed;
error messages only printed;
warnings and errors printed;
warnings, errors, and Optimizer log printed (default);
all messages printed.
Return value
0 if method executed successfully, 1 otherwise.
Description
1. BCL can produce different types of messages; status information, warnings and errors. This function controls which of these are output. For settings 1 or higher, the corresponding Optimizer output is also displayed. In addition to this setting, the amount of Optimizer output can be modified through several Optimizer printing control parameters (see the `Xpress Optimizer Reference Manual').
2. The setting applies to all problems that are created subsequently. It is also possible to change the setting for a particular problem (see XPRBprob).
Example
Related topics

setRealFmt
Synopsis
int setRealFmt(String fmt);
Argument
fmt 
Format string (as used by the C function printf). Simple format strings are of the form %n where n may be, for instance, one of
default printing format (precision: 6 digits; exponential notation if the exponent resulting from the conversion is less than -4 or greater than or equal to the precision)
.numf 
print real numbers in the style [-]d.d where the number of digits after the decimal point is equal to the given precision num.
Return value
0 if method executed successfully, 1 otherwise.
Description
1. In problems with very large or very small numbers it may become necessary to change the printing format to obtain a more exact output. In particular, by changing the precision it is possible to reduce the difference between matrices loaded in memory into Xpress Optimizer and the output produced by exporting them to a file.
2. The setting applies to all problems that are created subsequently. It is also possible to change the setting for a particular problem (see XPRBprob).
Example
This example sets the BCL number printing format to 8 digits after the decimal point. It then creates a problem and changes the number printing format for this problem back to the default:
XPRBprob *prob;

XPRB::init();
XPRB::setRealFmt("%.10f");

prob = new XPRBprob("myprob");
prob->setRealFmt("%g"); 
Related topics


© 2001-2024 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.