Creating a Problem File
Topics covered in this chapter:
For manually tuning a problem, we recommend using the Optimizer console. It is flexible and it is simple to experiment with control settings here and observe the results through the output log.
Before you start experimenting with your problem, you need to save it in a file format that the Xpress Optimizer console can read. We recommend using the MPS file format since it preserves the ordering of constraints and variables. It is an unfortunate yet known fact that simply reordering constraints and variables in a mixed integer problem can lead to different solution paths and, thereby, vastly different solve times.
To truly reproduce a solve exactly from within your Mosel model or your application in the console, you can use the saved state file format, which is a binary file format. It is possible to ask the Xpress Optimizer to save its internal state to a file, from which the Optimizer console can later restore the state. This saved state file is not humanly readable and is tied to the specific platform and release version of Xpress that it was created with. Note that this saved state file also includes any changes you have made to the default control parameter settings.
How to create an MPS file depends on the type of interface you use for accessing the Xpress Optimizer:
Optimizer Library C API
Once the problem has been loaded into the Xpress Optimizer, it can be written to an MPS file using the API call XPRSwriteprob():
XPRSwriteprob(prob, "myproblem", "");
This will save the current problem in prob in the MPS format to the file myproblem.mps.
In order to create the binary saved state file, you should add the call
XPRSsave(prob);
just before any call to XPRSmipoptimize(). The XPRSsave() function will write to a file whose name is given by the name of the problem itself. This name can be changed using XPRSsetprobname(). If the problem name is "myproblem", then XPRSsave() will create a file called myproblem.svf.
Equivalent functions exist for the Java, .Net and VB APIs. Please refer to the appropriate reference manual.
Xpress Mosel
In Mosel a problem will be passed to the Xpress Optimizer when you call the minimize or maximize procedures. It is always recommended to have the Xpress Optimizer write the problem it holds in memory directly to file, instead of using Mosel's own exportprob procedure. To do so, you first tell Mosel to load the problem into the Xpress Optimizer, and then to write it out. Assuming your objective function in the model is called myObjective, you should insert the following two lines just before any call to minimize/maximize:
loadprob(myObjective) writeprob("myproblem", "")
This will create a file named myproblem.mps.
It is also possible to create the saved state file from within Mosel; just replace the call to writeprob with a call to savestate, as in:
loadprob(ObjectiveFunction) savestate("myproblem.svf")
Make sure to include the .svf extension in the name, since this is expected by the Xpress Optimizer.
Builder Component Library (Xpress BCL)
In Xpress BCL you need to obtain a handle to the underlying Xpress Optimizer object. With it you can then create the problem file using the standard Xpress Optimizer library functions (refer to the above section on using the "Optimizer Library C API". You first need to tell BCL to load
XPRBprob bcl_prob; XPRSprob opt_prob; ... XPRBloadmat(bcl_prob); opt_prob = XPRBgetXPRSprob(bcl_prob); XPRSwriteprob(opt_prob, "myproblem", "p");
To create the saved state file, you simply replace the call to XPRSwriteprob() with a call to XPRSsave().
© 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.