classdef ResumeOptimizeAction < fxptui.internal.action.Action
    % ResumeOptimizeAction Action of resuming the optimization process
    
    %   Copyright 2021 The MathWorks, Inc.
    
    methods(Access = {?fxptui.internal.action.Action, ?WorkflowTestCase})
        
        function executeLocal(~, ~, workflowSetting)
            
            % extract the TopModel information from the DesignSetting
            designSettings = workflowSetting.getSettingValue('DesignSetting');
            topModel = designSettings.TopModel;
           
            result = fxptui.internal.action.getMostRecentResult(topModel, 'DataTypeOptimization.OptimizationResult');
            
            stoppingCriteriaOptions = struct( ...
                        'MaxIterations', result.OptimizationOptions.MaxIterations, ...
                        'MaxTime', result.OptimizationOptions.MaxTime, ...
                        'Patience', result.OptimizationOptions.Patience);

            DataTypeOptimization.resumeOptimization(result, stoppingCriteriaOptions);   
            
        end
        
    end
    
end


