changeCobraSolverParams Changes parameters for the Cobra Toolbox optimization solver(s) changeOK = changeCobraSolverParams(solverType,paramName,paramValue) INPUT solverType Solver type, 'LP' or 'MILP' (opt, default 'LP') paramName Parameter name paramValue Parameter value Allowed LP parameter names: objTol Optimal objective accuracy tolerance minNorm {(0), scalar , n x 1 vector}, where [m,n]=size(S); If not zero then, minimise the Euclidean length of the solution to the LP problem. minNorm ~1e-6 should be high enough for regularisation yet maintain the same value for the linear part of the objective. However, this should be checked on a case by case basis, by optimization with and without regularisation. printLevel Printing level = 0 Silent = 1 Warnings and Errors = 2 Summary information (Default) = 3 More detailed information > 10 Pause statements, and maximal printing (debug mode) primalOnly {(0),1} 1=only return the primal vector (lindo solvers) Allowed MILP parameter names: timeLimit Global time limit intTol Integer tolerance relMipGapTol Relative MIP gap tolerance logFile Internal log file for solver printLevel Print level for solver OUTPUT changeOK Logical inicator that supplied parameter is allowed (=1)
0001 function changeOK = changeCobraSolverParams(solverType,paramName,paramValue) 0002 %changeCobraSolverParams Changes parameters for the Cobra Toolbox optimization solver(s) 0003 % 0004 % changeOK = changeCobraSolverParams(solverType,paramName,paramValue) 0005 % 0006 % INPUT 0007 % solverType Solver type, 'LP' or 'MILP' (opt, default 0008 % 'LP') 0009 % paramName Parameter name 0010 % paramValue Parameter value 0011 % 0012 % Allowed LP parameter names: 0013 % objTol Optimal objective accuracy tolerance 0014 % 0015 % minNorm {(0), scalar , n x 1 vector}, where [m,n]=size(S); 0016 % If not zero then, minimise the Euclidean length 0017 % of the solution to the LP problem. minNorm ~1e-6 should be 0018 % high enough for regularisation yet maintain the same value for 0019 % the linear part of the objective. However, this should be 0020 % checked on a case by case basis, by optimization with and 0021 % without regularisation. 0022 % 0023 % printLevel Printing level 0024 % = 0 Silent 0025 % = 1 Warnings and Errors 0026 % = 2 Summary information (Default) 0027 % = 3 More detailed information 0028 % > 10 Pause statements, and maximal printing (debug mode) 0029 % 0030 % primalOnly {(0),1} 1=only return the primal vector (lindo solvers) 0031 % 0032 % Allowed MILP parameter names: 0033 % timeLimit Global time limit 0034 % intTol Integer tolerance 0035 % relMipGapTol Relative MIP gap tolerance 0036 % logFile Internal log file for solver 0037 % printLevel Print level for solver 0038 % 0039 % OUTPUT 0040 % changeOK Logical inicator that supplied parameter is allowed (=1) 0041 % 0042 0043 % Markus Herrgard 5/3/07 0044 % Jan Schellenberger 09/28/09 0045 % Ronan Fleming 12/07/09 commenting of input/output 0046 0047 changeOK = false; 0048 0049 allowedLPparams = {'objTol', 'primalOnly', 'minNorm', 'printLevel'}; 0050 allowedQPparams = {'minNorm', 'printLevel'}; 0051 allowedMILPparams = {'intTol','relMipGapTol','timeLimit','logFile','printLevel'}; 0052 0053 % Only LP is currently included 0054 switch solverType 0055 case 'LP' 0056 if (ismember(paramName,allowedLPparams)) 0057 global CBT_LP_PARAMS; 0058 CBT_LP_PARAMS.(paramName) = paramValue; 0059 changeOK = true; 0060 else 0061 error(['Parameter name ' paramName ' not allowed for LP solvers']); 0062 end 0063 case 'QP' 0064 if (ismember(paramName,allowedQPparams)) 0065 global CBT_QP_PARAMS; 0066 CBT_QP_PARAMS.(paramName) = paramValue; 0067 changeOK = true; 0068 else 0069 error(['Parameter name ' paramName ' not allowed for QP solvers']); 0070 end 0071 case 'MILP' 0072 if (ismember(paramName,allowedMILPparams)) 0073 global CBT_MILP_PARAMS; 0074 CBT_MILP_PARAMS.(paramName) = paramValue; 0075 changeOK = true; 0076 else 0077 error(['Parameter name ' paramName ' not allowed for MILP solvers']); 0078 end 0079 otherwise 0080 error(['solver type ' solverType ' not valid']); 0081 end