% cplexErrorMsg
%
%>> Usage: [exitMsg exitFlag] = cplexErrorMsg (Inform)
%
%>> Abstract: This function process the output message 'Inform' from CPLEX
% to generate a 'exitMsg' and a 'exitFlag'.
%
%>> Arguments:
% o In:
% Inform: Result of CPLEX run. Integer code which indicates the problem
% feasibility. The most common output codes are:
% -"101": Optimal integer solution found
% -"102": Optimal sol. within epgap or epagap tolerance found
% -"103": Solution is integer infeasible
%
% o Out:
% . exitMsg: Exit Message according to the output message 'Inform' from
% the CPLEX solver.
%
% . exitFlag:
% - 0, if it is possible to find a optimal solution.
% - 1, if it is not possible to find a feasible solution
% - 2, otherwise (a subpotimal solution)
%
% Ramon Aparicio Pardo.
% Technical University of Cartagena, 2007.
function [exitMsg exitFlag] = cplexErrorMsg (Inform)
switch(Inform)
case 0
exitMsg = 'Failed to optimize problem';
exitFlag=1;
case 1
exitMsg = 'Optimal solution is available ';
exitFlag=0;
case 2
exitMsg = 'Model has an Unbounded ray';
exitFlag=1;
case 3
exitMsg = 'Model is proved Infeasible';
exitFlag=1;
case 4
exitMsg = 'Model is proved either Infeasible or Unbounded ';
exitFlag=1;
case 5
exitMsg = 'Optimal solution is available, but with infeasibilities after unscaling';
exitFlag=0;
case 6
exitMsg = 'Solution is available, but not proved optimal, due to numerical difficulties during optimization';
exitFlag=2;
case 10
exitMsg = 'Aborted due to an iteration limit';
exitFlag=1;
case 11
exitMsg = 'Aborted due to a time limit';
exitFlag=1;
case 12
exitMsg = 'Aborted due to an objective limit';
exitFlag=1;
case 13
exitMsg = 'Aborted on user request';
exitFlag=1;
case 20
exitMsg = 'Model has Unbounded optimal face';
exitFlag=1;
case 21
exitMsg = 'Aborted due to a primal obj limit';
exitFlag=1;
case 22
exitMsg = 'Aborted due to a dual obj limit ';
exitFlag=1;
case 101
exitMsg = 'Optimal integer solution found';
exitFlag=0;
case 102
exitMsg = 'Optimal sol. within epgap or epagap tolerance found';
exitFlag=2;
case 103
exitMsg = 'Integer infeasible';
exitFlag=1;
case 104
exitMsg = 'Mixed integer solutions limit exceeded';
exitFlag=2;
case 105
exitMsg = 'Node limit exceeded, integer solution exists';
exitFlag=2;
case 106
exitMsg = 'Node limit exceeded, no integer solution';
exitFlag=2;
case 107
exitMsg = 'Time limit exceeded, integer solution exists';
exitFlag=2;
case 108
exitMsg = 'Time limit exceeded, no integer solution';
exitFlag=2;
case 109
exitMsg = 'Error termination, integer solution exists';
exitFlag=2;
case 110
exitMsg = 'Error termination, no integer solution';
exitFlag=1;
case 111
exitMsg = 'Treememory limit, integer solution exists';
exitFlag=2;
case 112
exitMsg = 'Treememory limit, no integer solution exists';
exitFlag=2;
case 113
exitMsg = 'Aborted, integer solution exists';
exitFlag=2;
case 114
exitMsg = 'Aborted, no integer solution';
exitFlag=2;
case 115
exitMsg = 'Problem optimal with unscaled infeasibilities';
exitFlag=2;
case 116
exitMsg = 'Out of memory, no tree, integer solution exists';
exitFlag=2;
case 117
exitMsg = 'Out of memory, no tree, no integer solution';
exitFlag=2;
case 118
exitMsg = 'Model has an Unbounded ray';
exitFlag=1;
case 119
exitMsg = 'Model has been proved either infeasible or unbounded';
exitFlag=1;
% For latest TOMLAB versions:
case 120
exitMsg = '(MIP) Feasible relaxed sum found (FEASOPTMODE)';
exitFlag=2;
case 121
exitMsg = '(MIP) Optimal relaxed sum found (FEASOPTMODE)';
exitFlag=2;
case 122
exitMsg = '(MIP) Feasible relaxed infeasibility found (FEASOPTMODE)';
exitFlag=2;
case 123
exitMsg = '(MIP) Optimal relaxed infeasibility found (FEASOPTMODE)';
exitFlag=2;
case 124
exitMsg = '(MIP) Feasible relaxed quad sum found (FEASOPTMODE)';
exitFlag=2;
case 125
exitMsg = '(MIP) Optimal relaxed quad sum found (FEASOPTMODE)';
exitFlag=2;
case 126
exitMsg = '(MIP) Relaxation aborted due to limit (FEASOPTMODE)';
exitFlag=2;
case 127
exitMsg = '(MIP) Feasible solution found (FEASOPTMODE)';
exitFlag=2;
case 1001
exitMsg = 'Insuficient memory available';
exitFlag=1;
case 1014
exitMsg = 'CPLEX parameter is too small';
exitFlag=1;
case 1015
exitMsg = '(CPLEX parameter is too big';
exitFlag=1;
case 1100
exitMsg = 'Lower and upper bounds contradictory';
exitFlag=1;
case 1101
exitMsg = 'The loaded problem contains blatant infeasibilities or unboundedness';
exitFlag=1;
case 1106
exitMsg = 'The user halted preprocessing by means of a callback';
exitFlag=1;
case 1117
exitMsg = 'The loaded problem contains blatant infeasibilities)';
exitFlag=1;
case 1118
exitMsg = 'The loaded problem contains blatant unboundedness';
exitFlag=1;
case 1123
exitMsg = 'Time limit exceeded during presolve.';
exitFlag=2;
case 1225
exitMsg = 'Numeric entry is not a double precision number (NAN)';
exitFlag=2;
case 1233
exitMsg = 'Data checking detected a number too large';
exitFlag=2;
case 1256
exitMsg = 'CPLEX cannot factor a singular basis';
exitFlag=1;
case 1261
exitMsg = 'No basic solution exists (use crossover)';
exitFlag=2;
case 1262
exitMsg = 'No basis exists (use crossover)';
exitFlag=2;
case 1719
exitMsg = 'No conflict is available';
exitFlag=2;
case 3413
exitMsg = 'Tree memory limit exceeded';
exitFlag=2;
case 5002
exitMsg = 'Non-positive semidefinite matrix in quadratic problem';
exitFlag=2;
case 5012
exitMsg = 'Non-symmetric matrix in quadratic problem';
exitFlag=2;
case 32201
exitMsg = 'A licensing error has occurred';
exitFlag=1;
case 32024
exitMsg = 'Licensing problem: Optimization algorithm not licensed';
exitFlag=1;
otherwise
exitMsg = 'Unknown Error!!! See CPLEX v.11 Help';
exitFlag=1;
end