Skip to content

Commit

Permalink
Merge pull request #70 from pvogt09/development
Browse files Browse the repository at this point in the history
Decouplingcontrol and additional optimizers
  • Loading branch information
pvogt09 authored Jul 31, 2021
2 parents de665fc + 0444eec commit 2224a0c
Show file tree
Hide file tree
Showing 210 changed files with 11,455 additions and 2,737 deletions.
2 changes: 1 addition & 1 deletion +compile/+control/+design/+gamma/constant.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
end
config = isset(config, 'max_system_states', 20);
config = isset(config, 'max_system_controls', 10);
config = isset(config, 'max_system_measurements', 10);
config = isset(config, 'max_system_measurements', 20);
config = isset(config, 'max_system_references', 10);
config = isset(config, 'max_number_of_systems', 1000);
config = isset(config, 'max_number_of_objective_functions', max([10, length(enumeration('GammaJType')) + 1]));
Expand Down
17 changes: 9 additions & 8 deletions +compile/+control/+design/+gamma/private/J_mex_common.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@
max_system_states = settings.max_system_states;
max_system_controls = settings.max_system_controls;
max_system_measurements = settings.max_system_measurements;
max_system_references = settings.max_system_references;
max_number_of_systems = settings.max_number_of_systems;
max_number_of_objective_functions = settings.max_number_of_objective_functions;
max_number_of_area_functions = settings.max_number_of_area_functions;
%#ok<*NASGU> unused variables are function arguments
system = struct(...
'E', coder.typeof(1, [max_system_states, max_system_states], [true, true]),...
'A', coder.typeof(1, [max_system_states, max_system_states], [true, true]),...
'B', coder.typeof(1, [max_system_controls, max_system_states], [true, true]),...
'B', coder.typeof(1, [max_system_states, max_system_controls], [true, true]),...
'C', coder.typeof(1, [max_system_measurements, max_system_states], [true, true]),...
'C_dot', coder.typeof(1, [max_system_measurements, max_system_states], [true, true]),...
'D', coder.typeof(1, [max_system_measurements, max_system_controls], [true, true]),...
Expand Down Expand Up @@ -87,17 +88,17 @@
'eigenvaluederivative', coder.newtype('GammaEigenvalueDerivativeType', [1, 1], [false, false]),...
'eigenvaluefilter', coder.newtype('GammaEigenvalueFilterType', [Inf, 1], [true, false]),...
'eigenvalueignoreinf', coder.typeof(true),...
'couplingcontrol', struct(...
'couplingconditions', coder.typeof(uint32(1)),...
'couplingstrategy', coder.newtype('GammaCouplingStrategy'),...
'sortingstrategy_coupling', coder.newtype('GammaCouplingconditionSortingStrategy'),...
'weight_coupling', coder.typeof(1),...
'decouplingcontrol', struct(...
'tf_structure', coder.typeof(1, [max_system_references, max_system_references], [true, true]),...
'decouplingstrategy', coder.newtype('GammaDecouplingStrategy'),...
'sortingstrategy_decoupling', coder.newtype('GammaDecouplingconditionSortingStrategy'),...
'weight_decoupling', coder.typeof(1),...
'weight_prefilter', coder.typeof(1),...
'tolerance_coupling', coder.typeof(1),...
'tolerance_decoupling', coder.typeof(1),...
'tolerance_prefilter', coder.typeof(1),...
'solvesymbolic', coder.typeof(true),...
'round_equations_to_digits', coder.typeof(double(0)),...
'allowoutputcoupling', coder.typeof(true)...
'allowoutputdecoupling', coder.typeof(true)...
),...
'objective', struct(...
'preventNaN', coder.typeof(true),...
Expand Down
17 changes: 9 additions & 8 deletions +compile/+control/+design/+gamma/private/c_mex_common.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@
max_system_states = settings.max_system_states;
max_system_controls = settings.max_system_controls;
max_system_measurements = settings.max_system_measurements;
max_system_references = settings.max_system_references;
max_number_of_systems = settings.max_number_of_systems;
max_number_of_objective_functions = settings.max_number_of_objective_functions;
max_number_of_area_functions = settings.max_number_of_area_functions;
%#ok<*NASGU> unused variables are function arguments
system = struct(...
'E', coder.typeof(1, [max_system_states, max_system_states], [true, true]),...
'A', coder.typeof(1, [max_system_states, max_system_states], [true, true]),...
'B', coder.typeof(1, [max_system_controls, max_system_states], [true, true]),...
'B', coder.typeof(1, [max_system_states, max_system_controls], [true, true]),...
'C', coder.typeof(1, [max_system_measurements, max_system_states], [true, true]),...
'C_dot', coder.typeof(1, [max_system_measurements, max_system_states], [true, true]),...
'D', coder.typeof(1, [max_system_measurements, max_system_controls], [true, true]),...
Expand Down Expand Up @@ -87,17 +88,17 @@
'eigenvaluederivative', coder.newtype('GammaEigenvalueDerivativeType', [1, 1], [false, false]),...
'eigenvaluefilter', coder.newtype('GammaEigenvalueFilterType', [Inf, 1], [true, false]),...
'eigenvalueignoreinf', coder.typeof(true),...
'couplingcontrol', struct(...
'couplingconditions', coder.typeof(uint32(1)),...
'couplingstrategy', coder.newtype('GammaCouplingStrategy'),...
'sortingstrategy_coupling', coder.newtype('GammaCouplingconditionSortingStrategy'),...
'weight_coupling', coder.typeof(1),...
'decouplingcontrol', struct(...
'tf_structure', coder.typeof(1, [max_system_references, max_system_references], [true, true]),...
'decouplingstrategy', coder.newtype('GammaDecouplingStrategy'),...
'sortingstrategy_decoupling', coder.newtype('GammaDecouplingconditionSortingStrategy'),...
'weight_decoupling', coder.typeof(1),...
'weight_prefilter', coder.typeof(1),...
'tolerance_coupling', coder.typeof(1),...
'tolerance_decoupling', coder.typeof(1),...
'tolerance_prefilter', coder.typeof(1),...
'solvesymbolic', coder.typeof(true),...
'round_equations_to_digits', coder.typeof(double(0)),...
'allowoutputcoupling', coder.typeof(true)...
'allowoutputdecoupling', coder.typeof(true)...
),...
'objective', struct(...
'preventNaN', coder.typeof(true),...
Expand Down
125 changes: 64 additions & 61 deletions +compile/+control/+design/+gamma/private/dimensionarg.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,72 +5,75 @@
% areaparameters: coder type for area parameters
% Output:
% dimensions: coder type for dimensions argument
max_system_states = settings.max_system_states;
max_system_controls = settings.max_system_controls;
max_system_measurements = settings.max_system_measurements;
max_system_references = settings.max_system_references;
max_number_of_systems = settings.max_number_of_systems;
max_number_of_area_functions = settings.max_number_of_area_functions;
dimensions = struct(...
'models', coder.typeof(int32(1)),...
'states', coder.typeof(int32(1)),...
'controls', coder.typeof(int32(1)),...
'measurements', coder.typeof(int32(1)),...
'measurements_xdot', coder.typeof(int32(1)),...
'references', coder.typeof(int32(1)),...
'couplingconditions', coder.typeof(int32(1)),...
'm_invariant', coder.typeof(int32(1)),...
'hasfeedthrough_coupling', coder.typeof(true),...
'descriptor', coder.typeof(true),...
'isdiscrete', coder.typeof(true),...
'areas_max', coder.typeof(int32(1)),...
'area_args', coder.typeof(int32(1), [max_number_of_systems, 1], [true, false]),...
'area_parts', coder.typeof(int32(1), [max_number_of_systems, 1], [true, false]),...
'area_hasgrad', coder.typeof(true, 1, 1),...
'area_hashess', coder.typeof(true, 1, 1),...
'area_parameters', coder.typeof(areaparameters, [max_number_of_systems, max_number_of_area_functions], [true, true]),...
'R_fixed_has', coder.typeof(true),...
'R_fixed_only', coder.typeof(true),...
'R_fixed_constraints', coder.typeof(int32(1)),...
'R_fixed', coder.typeof(true, [max_system_controls, max_system_measurements], [true, true]),...
'R_fixed_values', coder.typeof(1, [max_system_controls, max_system_measurements], [true, true]),...
'R_fixed_A', coder.typeof(1, [max_system_controls*max_system_measurements - 1, max_system_controls*max_system_measurements], [true, true]),...
'R_fixed_b', coder.typeof(1, [max_system_controls*max_system_measurements - 1, 1], [true, false]),...
'R_fixed_T', coder.typeof(1, [max_system_controls*max_system_measurements - 1, max_system_controls*max_system_measurements - 1], [true, true]),...
'R_fixed_T_inv', coder.typeof(1, [max_system_controls*max_system_measurements - 1, max_system_controls*max_system_measurements - 1], [true, true]),...
'R_isforced2zero', coder.typeof(true),...
'K_fixed_has', coder.typeof(true),...
'K_fixed_only', coder.typeof(true),...
'K_fixed_constraints', coder.typeof(int32(1)),...
'K_fixed', coder.typeof(true, [max_system_controls, max_system_measurements], [true, true]),...
'K_fixed_values', coder.typeof(1, [max_system_controls, max_system_measurements], [true, true]),...
'K_fixed_A', coder.typeof(1, [max_system_controls*max_system_measurements - 1, max_system_controls*max_system_measurements], [true, true]),...
'K_fixed_b', coder.typeof(1, [max_system_controls*max_system_measurements - 1, 1], [true, false]),...
'K_fixed_T', coder.typeof(1, [max_system_controls*max_system_measurements - 1, max_system_controls*max_system_measurements - 1], [true, true]),...
'K_fixed_T_inv', coder.typeof(1, [max_system_controls*max_system_measurements - 1, max_system_controls*max_system_measurements - 1], [true, true]),...
'K_isforced2zero', coder.typeof(true),...
'F_fixed_has', coder.typeof(true),...
'F_fixed_only', coder.typeof(true),...
'F_fixed_constraints', coder.typeof(int32(1)),...
'F_fixed', coder.typeof(true, [max_system_controls, max_system_references], [true, true]),...
'F_fixed_values', coder.typeof(1, [max_system_controls, max_system_references], [true, true]),...
'F_fixed_A', coder.typeof(1, [max_system_controls*max_system_references - 1, max_system_controls*max_system_references], [true, true]),...
'F_fixed_b', coder.typeof(1, [max_system_controls*max_system_references - 1, 1], [true, false]),...
'F_fixed_T', coder.typeof(1, [max_system_controls*max_system_references - 1, max_system_controls*max_system_references - 1], [true, true]),...
'F_fixed_T_inv', coder.typeof(1, [max_system_controls*max_system_references - 1, max_system_controls*max_system_references - 1], [true, true]),...
'F_isforced2zero', coder.typeof(true),...
'RKF_fixed_has', coder.typeof(true),...
'RKF_fixed_only', coder.typeof(true),...
'RKF_fixed_constraints', coder.typeof(int32(1)),...
'RKF_fixed', coder.typeof(true, [max_system_controls, 2*max_system_measurements + max_system_references], [true, true]),...
'RKF_fixed_values', coder.typeof(1, [max_system_controls, 2*max_system_measurements + max_system_references], [true, true]),...
'RKF_fixed_A', coder.typeof(1, [max_system_controls*(2*max_system_measurements + max_system_references) - 1, max_system_controls*(2*max_system_measurements + max_system_references)], [true, true]),...
'RKF_fixed_b', coder.typeof(1, [max_system_controls*(2*max_system_measurements + max_system_references) - 1, 1], [true, false]),...
'RKF_fixed_T', coder.typeof(1, [max_system_controls*(2*max_system_measurements + max_system_references) - 1, max_system_controls*(2*max_system_measurements + max_system_references) - 1], [true, true]),...
'RKF_fixed_T_inv', coder.typeof(1, [max_system_controls*(2*max_system_measurements + max_system_references) - 1, max_system_controls*(2*max_system_measurements + max_system_references) - 1], [true, true]),...
'index_R_free', coder.typeof(true, [max_system_controls*(2*max_system_measurements + max_system_references), 1], [true, false]),...
'index_K_free', coder.typeof(true, [max_system_controls*(2*max_system_measurements + max_system_references), 1], [true, false]),...
'index_F_free', coder.typeof(true, [max_system_controls*(2*max_system_measurements + max_system_references), 1], [true, false]),...
'index_RKF_free', coder.typeof(true, [max_system_controls*(2*max_system_measurements + max_system_references), 1], [true, false]),...
'index_all_free', coder.typeof(true, [max_system_controls*(2*max_system_measurements + max_system_references), 1], [true, false])...
'models', coder.typeof(int32(1)),...
'states', coder.typeof(int32(1)),...
'controls', coder.typeof(int32(1)),...
'measurements', coder.typeof(int32(1)),...
'measurements_xdot', coder.typeof(int32(1)),...
'references', coder.typeof(int32(1)),...
'tf_structure', coder.typeof(1, [max_system_references, max_system_references], [true, true]),...
'number_decouplingconditions', coder.typeof(int32(1), [max_system_references, 1], [true, false]),...
'V_invariant', coder.typeof(1, [max_number_of_systems, max_system_states, max_system_states, max_system_references], [true, true, true, true]),...
'm_invariant', coder.typeof(int32(1), [max_system_references, 1], [true, false]),...
'hasfeedthrough_decoupling', coder.typeof(true, [max_system_references, 1], [true, false]),...
'descriptor', coder.typeof(true),...
'isdiscrete', coder.typeof(true),...
'areas_max', coder.typeof(int32(1)),...
'area_args', coder.typeof(int32(1), [max_number_of_systems, 1], [true, false]),...
'area_parts', coder.typeof(int32(1), [max_number_of_systems, 1], [true, false]),...
'area_hasgrad', coder.typeof(true, 1, 1),...
'area_hashess', coder.typeof(true, 1, 1),...
'area_parameters', coder.typeof(areaparameters, [max_number_of_systems, max_number_of_area_functions], [true, true]),...
'R_fixed_has', coder.typeof(true),...
'R_fixed_only', coder.typeof(true),...
'R_fixed_constraints', coder.typeof(int32(1)),...
'R_fixed', coder.typeof(true, [max_system_controls, max_system_measurements], [true, true]),...
'R_fixed_values', coder.typeof(1, [max_system_controls, max_system_measurements], [true, true]),...
'R_fixed_A', coder.typeof(1, [max_system_controls*max_system_measurements - 1, max_system_controls*max_system_measurements], [true, true]),...
'R_fixed_b', coder.typeof(1, [max_system_controls*max_system_measurements - 1, 1], [true, false]),...
'R_fixed_T', coder.typeof(1, [max_system_controls*max_system_measurements - 1, max_system_controls*max_system_measurements - 1], [true, true]),...
'R_fixed_T_inv', coder.typeof(1, [max_system_controls*max_system_measurements - 1, max_system_controls*max_system_measurements - 1], [true, true]),...
'R_isforced2zero', coder.typeof(true),...
'K_fixed_has', coder.typeof(true),...
'K_fixed_only', coder.typeof(true),...
'K_fixed_constraints', coder.typeof(int32(1)),...
'K_fixed', coder.typeof(true, [max_system_controls, max_system_measurements], [true, true]),...
'K_fixed_values', coder.typeof(1, [max_system_controls, max_system_measurements], [true, true]),...
'K_fixed_A', coder.typeof(1, [max_system_controls*max_system_measurements - 1, max_system_controls*max_system_measurements], [true, true]),...
'K_fixed_b', coder.typeof(1, [max_system_controls*max_system_measurements - 1, 1], [true, false]),...
'K_fixed_T', coder.typeof(1, [max_system_controls*max_system_measurements - 1, max_system_controls*max_system_measurements - 1], [true, true]),...
'K_fixed_T_inv', coder.typeof(1, [max_system_controls*max_system_measurements - 1, max_system_controls*max_system_measurements - 1], [true, true]),...
'K_isforced2zero', coder.typeof(true),...
'F_fixed_has', coder.typeof(true),...
'F_fixed_only', coder.typeof(true),...
'F_fixed_constraints', coder.typeof(int32(1)),...
'F_fixed', coder.typeof(true, [max_system_controls, max_system_references], [true, true]),...
'F_fixed_values', coder.typeof(1, [max_system_controls, max_system_references], [true, true]),...
'F_fixed_A', coder.typeof(1, [max_system_controls*max_system_references - 1, max_system_controls*max_system_references], [true, true]),...
'F_fixed_b', coder.typeof(1, [max_system_controls*max_system_references - 1, 1], [true, false]),...
'F_fixed_T', coder.typeof(1, [max_system_controls*max_system_references - 1, max_system_controls*max_system_references - 1], [true, true]),...
'F_fixed_T_inv', coder.typeof(1, [max_system_controls*max_system_references - 1, max_system_controls*max_system_references - 1], [true, true]),...
'F_isforced2zero', coder.typeof(true),...
'RKF_fixed_has', coder.typeof(true),...
'RKF_fixed_only', coder.typeof(true),...
'RKF_fixed_constraints', coder.typeof(int32(1)),...
'RKF_fixed', coder.typeof(true, [max_system_controls, 2*max_system_measurements + max_system_references], [true, true]),...
'RKF_fixed_values', coder.typeof(1, [max_system_controls, 2*max_system_measurements + max_system_references], [true, true]),...
'RKF_fixed_A', coder.typeof(1, [max_system_controls*(2*max_system_measurements + max_system_references) - 1, max_system_controls*(2*max_system_measurements + max_system_references)], [true, true]),...
'RKF_fixed_b', coder.typeof(1, [max_system_controls*(2*max_system_measurements + max_system_references) - 1, 1], [true, false]),...
'RKF_fixed_T', coder.typeof(1, [max_system_controls*(2*max_system_measurements + max_system_references) - 1, max_system_controls*(2*max_system_measurements + max_system_references) - 1], [true, true]),...
'RKF_fixed_T_inv', coder.typeof(1, [max_system_controls*(2*max_system_measurements + max_system_references) - 1, max_system_controls*(2*max_system_measurements + max_system_references) - 1], [true, true]),...
'index_R_free', coder.typeof(true, [max_system_controls*(2*max_system_measurements + max_system_references), 1], [true, false]),...
'index_K_free', coder.typeof(true, [max_system_controls*(2*max_system_measurements + max_system_references), 1], [true, false]),...
'index_F_free', coder.typeof(true, [max_system_controls*(2*max_system_measurements + max_system_references), 1], [true, false]),...
'index_RKF_free', coder.typeof(true, [max_system_controls*(2*max_system_measurements + max_system_references), 1], [true, false]),...
'index_all_free', coder.typeof(true, [max_system_controls*(2*max_system_measurements + max_system_references), 1], [true, false])...
);
end
51 changes: 51 additions & 0 deletions +compile/minfunc.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
function [success, fileinfo] = minfunc(overwrite, nobuild)
%MTIMES3D compile minFunc
% Input:
% overwrite: indicator, if mex file should be overwritten
% nobuild: indicator, if compilation should not be done and only the file to compile should be returned
% Output:
% success: true, if compilation was successful, else false
% fileinfo: information about the compiled function
if nargin < 1
overwrite = true;
end
if nargin <= 1
nobuild = false;
end
file = realpath(fullfile(compile.destpath(), 'lib', 'optimization', 'minFunc', 'minFunc', 'mex', 'lbfgsC'));
if nargout >= 2
fileinfo = struct(...
'm', '',...
'c', [file, '.c'],...
'mex', [file, '.', mexext],...
'build', [mfilename('fullpath'), '.m']...
);
end
if nobuild
success = true;
return;
end
currdir = pwd();
cd(fullfile(compile.destpath(), 'lib', 'optimization', 'minFunc'));
try
if overwrite
mexAll;
end
success = true;
catch e
if ~configuration.matlab.hascodertoolbox()
warning(e.identifier, 'No license for Matlab Coder Toolbox available.');
else
if strcmpi('', e.message)
warning(e.identifier, 'Error in code generation.');
else
warning(e.identifier, e.message);
end
end
success = false;
end
cd(currdir);
if nargout < 1
clear success;
end
end
Loading

0 comments on commit 2224a0c

Please sign in to comment.