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-04-21
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-04-21 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 mosekParams.MSK_DPAR_PRESOLVE_TOL_LIN_DEP=10^-9; 0034 0035 %Turn off the presolve. This is because Mosek sometimes returns non-feasible 0036 %solutions because of problems with the presolver. Should check if version 0037 %is <6.0.0.147 0038 mosekParams.MSK_IPAR_PRESOLVE_USE=0; 0039 0040 %Use a starting integer solution if supplied. This has no effect if no such 0041 %solution is supplied 0042 %mosekParams.MSK_IPAR_MIO_CONSTRUCT_SOL=1; 0043 0044 %10 hours as default upper time limit 0045 mosekParams.MSK_DPAR_OPTIMIZER_MAX_TIME=10*60*60; 0046 0047 if isfield(params,'maxTime') 0048 mosekParams.MSK_DPAR_OPTIMIZER_MAX_TIME=params.maxTime*60; 0049 mosekParams=rmfield(mosekParams,'maxTime'); 0050 end 0051 if isfield(params,'relGap') 0052 mosekParams.MSK_DPAR_MIO_TOL_REL_GAP=params.relGap; 0053 mosekParams=rmfield(mosekParams,'relGap'); 0054 end 0055 if isfield(params,'printReport') 0056 mosekParams=rmfield(mosekParams,'printReport'); 0057 end 0058 end