Checks if a solution from Mosek is feasible and optimal res the output structure from mosekopt isFeasible true if the solution is feasible isoptimal true if the solution is optimal This function also throws an error if the license has expired. Usage: [isFeasible, isOptimal]=checkSolution(res)
0001 function [isFeasible, isOptimal]=checkSolution(res) 0002 % Checks if a solution from Mosek is feasible and optimal 0003 % 0004 % res the output structure from mosekopt 0005 % 0006 % isFeasible true if the solution is feasible 0007 % isoptimal true if the solution is optimal 0008 % 0009 % This function also throws an error if the license has expired. 0010 % 0011 % Usage: [isFeasible, isOptimal]=checkSolution(res) 0012 0013 isFeasible=false; 0014 isOptimal=false; 0015 0016 switch res.stat 0017 case 1 0018 isOptimal=true; 0019 isFeasible=true; 0020 case 2 0021 isOptimal=false; 0022 isFeasible=true; 0023 otherwise 0024 isOptimal=false; 0025 isFeasible=false; 0026 end 0027 end