Home > RAVEN > getMILPParams.m

getMILPParams

PURPOSE ^

getMILPParams

SYNOPSIS ^

function mosekParams=getMILPParams(params)

DESCRIPTION ^

 getMILPParams
   Returns a MOSEK parameter structure used when solving mixed-integer
   linear programming problems

    params          structure with one or more of the following fields
       maxTime     maximal running time in minutes (opt, default 600)
       relGap      maximal relative gap between integer and relaxed
                   solution in order to be considered optimal (0.0-1.0)
                   (opt, default 0.2)
       printReport true if the results of the optimization should be
                   displayed on the screen (opt, default false) 

   mosekParams     a parameter structure to be used with MOSEK

   Usage: mosekParams=getMILPParams(params)

   Rasmus Agren, 2013-07-16

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function mosekParams=getMILPParams(params)
0002 % getMILPParams
0003 %   Returns a MOSEK parameter structure used when solving mixed-integer
0004 %   linear programming problems
0005 %
0006 %    params          structure with one or more of the following fields
0007 %       maxTime     maximal running time in minutes (opt, default 600)
0008 %       relGap      maximal relative gap between integer and relaxed
0009 %                   solution in order to be considered optimal (0.0-1.0)
0010 %                   (opt, default 0.2)
0011 %       printReport true if the results of the optimization should be
0012 %                   displayed on the screen (opt, default false)
0013 %
0014 %   mosekParams     a parameter structure to be used with MOSEK
0015 %
0016 %   Usage: mosekParams=getMILPParams(params)
0017 %
0018 %   Rasmus Agren, 2013-07-16
0019 %
0020 
0021 if nargin<1
0022     params=[];
0023 end
0024 
0025 mosekParams=params;
0026 mosekParams.MSK_DPAR_MIO_TOL_ABS_RELAX_INT=10^-9;
0027 mosekParams.MSK_DPAR_MIO_TOL_REL_GAP=0.05;
0028 mosekParams.MSK_DPAR_MIO_TOL_REL_RELAX_INT=10^-9;
0029 mosekParams.MSK_DPAR_MIO_TOL_X=10^-9;
0030 mosekParams.MSK_DPAR_MIO_TOL_FEAS=10^-9;
0031 mosekParams.MSK_DPAR_BASIS_TOL_S=10^-9;
0032 mosekParams.MSK_DPAR_BASIS_TOL_X=10^-9;
0033 
0034 %Get the mosek version. This is a bit problematic since the Mosek function
0035 %for getting the version came in version 7.
0036 try
0037     mosekopt('version echo(0)');
0038     mosekParams.MSK_DPAR_PRESOLVE_TOL_ABS_LINDEP=10^-9;
0039     mosekParams.MSK_IPAR_PRESOLVE_USE=1;
0040 catch
0041     %This means that it's before the "late" version 6
0042     mosekParams.MSK_DPAR_PRESOLVE_TOL_LIN_DEP=10^-9;
0043     %Turn off the presolve. This is because Mosek sometimes returns non-feasible
0044     %solutions because of problems with the presolver. Should check if version
0045     %is <6.0.0.147
0046     mosekParams.MSK_IPAR_PRESOLVE_USE=0;
0047 end
0048 
0049 %Use a starting integer solution if supplied. This has no effect if no such
0050 %solution is supplied
0051 %mosekParams.MSK_IPAR_MIO_CONSTRUCT_SOL=1;
0052 
0053 %10 hours as default upper time limit
0054 mosekParams.MSK_DPAR_OPTIMIZER_MAX_TIME=10*60*60;
0055 
0056 if isfield(params,'maxTime')
0057     mosekParams.MSK_DPAR_OPTIMIZER_MAX_TIME=params.maxTime*60;
0058     mosekParams=rmfield(mosekParams,'maxTime');
0059 end
0060 if isfield(params,'relGap')
0061     mosekParams.MSK_DPAR_MIO_TOL_REL_GAP=params.relGap;
0062     mosekParams=rmfield(mosekParams,'relGap');
0063 end
0064 if isfield(params,'printReport')
0065     mosekParams=rmfield(mosekParams,'printReport');
0066 end
0067 end

Generated on Tue 16-Jul-2013 21:50:02 by m2html © 2005