%This Example for using users m-function Optimization_subroutine.m was created automatically by PSG Toolbox. %Function description: %minimize %linearize = 1 %meanabs_pen(matrix_scenarios) %Constraint: <= parameter_bound, linearize = 1 %polynom_abs(matrix_constraint_budget) %Constraint: <= parameter_bound_1, linearize = 1 %cardn(parameter_alpha, matrix_constraint_card_new) %Box: >= point_lowerbounds, <= point_upperbounds %Solver: parameter_solver, precision = parameter_precision % %Input variables: % %Inputs PSG Type PSG Object Location in Problem Statement Class %matrix_scenarios_benchmark bench matrix_scenarios meanabs_pen(matrix_scenarios) double %matrix_scenarios_data data matrix_scenarios meanabs_pen(matrix_scenarios) double %matrix_scenarios_vars vars matrix_scenarios meanabs_pen(matrix_scenarios) cell %matrix_constraint_budget_data data matrix_constraint_budget polynom_abs(matrix_constraint_budget) double %matrix_constraint_budget_vars vars matrix_constraint_budget polynom_abs(matrix_constraint_budget) cell %matrix_constraint_card_new_benchmark bench matrix_constraint_card_new cardn(parameter_alpha, matrix_constraint_card_new) double %matrix_constraint_card_new_probability prob matrix_constraint_card_new cardn(parameter_alpha, matrix_constraint_card_new) double %matrix_constraint_card_new_data data matrix_constraint_card_new cardn(parameter_alpha, matrix_constraint_card_new) double %matrix_constraint_card_new_vars vars matrix_constraint_card_new cardn(parameter_alpha, matrix_constraint_card_new) cell %point_lowerbounds_data data point_lowerbounds Box: >= point_lowerbounds, <= point_upperbounds double %point_lowerbounds_vars vars point_lowerbounds Box: >= point_lowerbounds, <= point_upperbounds cell %point_upperbounds_data data point_upperbounds Box: >= point_lowerbounds, <= point_upperbounds double %point_upperbounds_vars vars point_upperbounds Box: >= point_lowerbounds, <= point_upperbounds cell %parameter_bound_data data parameter_bound Constraint: <= parameter_bound, linearize = 1 double %parameter_bound_1_data data parameter_bound_1 Constraint: <= parameter_bound_1, linearize = 1 double %parameter_alpha_data data parameter_alpha cardn(parameter_alpha, matrix_constraint_card_new) double %parameter_solver_data data parameter_solver Solver: parameter_solver, precision = parameter_precision char %parameter_precision_data data parameter_precision Solver: parameter_solver, precision = parameter_precision char % %Output variables: % %solution_str = string with solution of problem; %outargstruc_arr = array of output PSG data structures; %Load data from mat-file: load('D:\American Optimal Decisions\PSG\MATLAB_Stan\All\Optimal Hedging of CDO Book\data_problem_cdohedge_1_short\Optimization_subroutine_data.mat') %Save variables from mat-file to Workspace: tbpsg_export_to_workspace(toolboxstruc_arr) %Run users m-function Optimization_subroutine: [solution_str,outargstruc_arr] = Optimization_subroutine(matrix_scenarios_benchmark,matrix_scenarios_data,matrix_scenarios_vars,matrix_constraint_budget_data,matrix_constraint_budget_vars,matrix_constraint_card_new_benchmark,matrix_constraint_card_new_probability,matrix_constraint_card_new_data,matrix_constraint_card_new_vars,point_lowerbounds_data,point_lowerbounds_vars,point_upperbounds_data,point_upperbounds_vars,parameter_bound_data,parameter_bound_1_data,parameter_alpha_data,parameter_solver_data,parameter_precision_data); %Extract Objective: val_obj = tbpsg_objective(solution_str, outargstruc_arr); disp(' '); disp('Objective = '); disp(val_obj); %Extract optimal solution: point_data = tbpsg_optimal_point_data(solution_str, outargstruc_arr); disp(' '); disp('Optimal point = '); disp(point_data); %Extract structure containing PSG solution reports: output_structure = tbpsg_solution_struct(solution_str, outargstruc_arr); disp(' '); disp('Structure with PSG solution = '); disp(output_structure); %Uncomment the following lines to extract solutions details: %output = tbpsg_isoptimal(solution_str, outargstruc_arr); %output = tbpsg_function_data(solution_str, outargstruc_arr); %output = tbpsg_function_names(solution_str, outargstruc_arr); %output = tbpsg_time(solution_str, outargstruc_arr); %output = tbpsg_optimal_point_vars(solution_str, outargstruc_arr); %output = tbpsg_constraints_vars(solution_str, outargstruc_arr); %output = tbpsg_slack_data(solution_str, outargstruc_arr); %output = tbpsg_dual_data(solution_str, outargstruc_arr); %output = tbpsg_vector_constraint_data(solution_str, outargstruc_arr); %output = tbpsg_vector_dual_data(solution_str, outargstruc_arr); %output = tbpsg_vector_slack_data(solution_str, outargstruc_arr); %output = tbpsg_matrix_data(solution_str, outargstruc_arr); %output = tbpsg_matrix_vars(solution_str, outargstruc_arr); %output = tbpsg_vector_data(solution_str, outargstruc_arr);