Code covered by the BSD License  

Highlights from
Simultaneous Plant and Control Design of an Active Automotive Suspension Using Direct Transcription

image thumbnail

Simultaneous Plant and Control Design of an Active Automotive Suspension Using Direct Transcription

by

 

A toolbox for using Direct Transcription to perform combined plant and control design.

OptionFactory
classdef OptionFactory
    % OptionFactory makes new opimization options for different purposes
    
    % See makeOption.m for use of this class
    
    % Design pattern: singleton, factory
    
    methods
        function opt = makeOption(obj, use)
            opt = makeOptionImpl(use);
        end
    end

    methods (Access = 'protected')
        function obj = OptionFactory()
        end
        function destroy(obj)
        end
    end
    
    methods (Static)
        function factory = getInstance()
            persistent localStaticObj;
            if isempty(localStaticObj)
                localStaticObj = OptionFactory;
            end
            factory = localStaticObj;
        end
    end
    
end

function opt = makeOptionImpl(use)
switch use
    case 'SanityCheck'
        opt = optimset('algorithm','interior-point',...
            'MaxIter', 10, 'MaxFunEvals', 10, ...
            'LargeScale', 'on', ...
            'TolFun',1e-3, 'UseParallel','never', ...
            'GradConstr','on', 'GradObj','on', 'DerivativeCheck','on');
        
    case 'DryRun'
        opt = optimset('algorithm','interior-point',...
            'Display', 'Iter', ...
            'MaxIter', 10, 'MaxFunEvals', 10, ...
            'LargeScale', 'on', ...
            'UseParallel','never', ...
            'Hessian', 'lbfgs', ...
            'GradConstr','on', 'GradObj','on', 'DerivativeCheck','off');
    case 'MoreRun'
        opt = optimset('algorithm','interior-point',...
            'Display', 'Iter', ...
            'MaxIter', 200, 'MaxFunEvals', 1000, ...
            'LargeScale', 'on', ...
            'GradConstr','on', 'GradObj','on', 'DerivativeCheck','off');
    case 'Display'
         opt = optimset('algorithm','interior-point',...
             'Display', 'iter', ...
            'MaxIter', 1e+6, 'MaxFunEvals', 1e+6, ...
            'LargeScale', 'on', ...
            'TolFun',1e-6, 'UseParallel','always', ...
            'GradConstr','on', 'GradObj','on', 'DerivativeCheck','off');        
        
    otherwise
         opt = optimset('algorithm','interior-point',...
             'Display', 'off', ...
            'MaxIter', 1e+3, 'MaxFunEvals', 1e+6, ...
            'LargeScale', 'on', ...
            'TolX', 1e-6, ...  
            'TolFun',1e-6, 'UseParallel','always', ...
            'GradConstr','on', 'GradObj','on', 'DerivativeCheck','off');
end       
        
end

Contact us