1classdef OptimizationResult < handle
2 % OptimizationResult Result from a single optimization run. Mirrors
3 % native-Python line_solver.opt.results.OptimizationResult.
7 variableValues % Map name -> value (scalar or vector)
8 constraintViolations % Map name -> violation
13 convergenceHistory = [];
18 function obj = OptimizationResult()
19 obj.variableValues = containers.Map('KeyType', '
char', 'ValueType', 'any');
20 obj.constraintViolations = containers.Map('KeyType', '
char', 'ValueType', '
double');
23 function tf = isFeasible(obj)
26 function v = getObjectiveValue(obj)
27 v = obj.objectiveValue;
29 function v = getVariableValue(obj, name)
30 if isKey(obj.variableValues, name), v = obj.variableValues(name); else, v = []; end
32 function v = getConstraintViolation(obj, name)
33 if isKey(obj.constraintViolations, name), v = obj.constraintViolations(name); else, v = 0.0; end
35 function v = getTotalViolation(obj)
36 if obj.constraintViolations.Count == 0, v = 0.0;
37 else, v = sum(cell2mat(values(obj.constraintViolations))); end