Skip to content

Commit

Permalink
option to disable function plot in optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
wahln committed Feb 3, 2023
1 parent ffced04 commit 46445b2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion optimization/optimizer/matRad_OptimizerIPOPT.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
wResult
resultInfo
env

%Visualization
showPlot = true;
end

properties (Access = private)
Expand Down Expand Up @@ -107,6 +110,10 @@
matRad_cfg.dispError('IPOPT mex interface not available for %s!',obj.env);
end

if matRad_cfg.disableGUI || (matRad_cfg.isOctave && isequal(graphics_toolkit(),'gnuplot'))
obj.showPlot = false;
end

end

function obj = optimize(obj,w0,optiProb,dij,cst)
Expand Down Expand Up @@ -244,7 +251,7 @@
obj.allObjectiveFunctionValues(iter + 1) = objective;
%We don't want the optimization to crash because of drawing
%errors
if ~obj.plotFailed
if obj.showPlot && ~obj.plotFailed
try
obj.plotFunction();
catch ME
Expand Down

0 comments on commit 46445b2

Please sign in to comment.