Xpress Using the Matlab Interface

From TomWiki
Jump to navigationJump to search

Notice.png

This page is part of the Xpress Manual. See Xpress Manual.

The two main routines in the two-layer design of the interface are shown in #Table: The interface routines.. Page and section references are given to detailed descriptions on how to use the routines. The user that is not using TOMLAB can skip reading about the routine xpressTL. A normal user, not using callbacks, only has to read about how to call the level 1 interface routine xpress.

Table: The interface routines.

Function Description
xpress The layer one Matlab interface routine, calls the MEX-file interface xpressmp.dll
xpressTL The layer two TOMLAB interface routine that calls xpress.m. Converts the input Prob format before calling xpress.m and converts back to the output Result structure.

The XpressMP control variables, see Xpress xpControl, are all possible to set from Matlab. They could be set as input to the interface routine xpress, but also in the callback routines. The user sets fields in a structure called xpcontrol, where the subfield names are the same as the names of the control variables. The following example shows how to set the values for one integer variable XPRSLPITERLIMIT, one double variable XPRSOPTIMALITYTOL, and one character variable valued variable XPRSOBJNAME. TOMLAB /Xpress does not use the prefix XPRS in the Matlab structures.

apcontrol.LPITERLIMIT	= 50; 		%   Setting maximal number of global iterations 
xpcontrol.OPTIMALITYTOL = 1E-5;		%   Changing reduced cost tolerance 
xpcontrol.OBJNAME 	= 'ObjF1';	%   New name of the objective function

Character valued variables should have <= 64 characters.

Note that after the call to the Xpress MP interface, two global variables are available, xpControlVariables and xpProblemAttrib. As subfields they hold the current values of all XpressMP control variables, and all problem attributes. To list all their fields, just define the variables as global and give their names

global xpControlVariables xpProblemAttrib 
xpControlVariables
xpProblemAttrib