%This Example for using users m-function Optimization_subroutine.m was created automatically by PSG Toolbox. %Function description: %minimize %avg(recourse(matrix_xfirst_pltexpa2, matrix_subproblem_pltexpa2, matrix_of_scenarios_pltexpa2_6)) %Constraint: >= vector_l_pltexpa2, <= vector_u_pltexpa2 %linearmulti(matrix_xmulti_pltexpa2) %Box: >= parameter_bound, <= parameter_bound_1 % % %Input variables: % %Inputs PSG Type PSG Object Location in Problem Statement Class %matrix_xfirst_pltexpa2_data data matrix_xfirst_pltexpa2 avg(recourse(matrix_xfirst_pltexpa2, matrix_subproblem_pltexpa2, matrix_of_scenarios_pltexpa2_6)) double %matrix_xfirst_pltexpa2_vars vars matrix_xfirst_pltexpa2 avg(recourse(matrix_xfirst_pltexpa2, matrix_subproblem_pltexpa2, matrix_of_scenarios_pltexpa2_6)) cell %matrix_xmulti_pltexpa2_benchmark bench matrix_xmulti_pltexpa2 linearmulti(matrix_xmulti_pltexpa2) double %matrix_xmulti_pltexpa2_data data matrix_xmulti_pltexpa2 linearmulti(matrix_xmulti_pltexpa2) double %matrix_xmulti_pltexpa2_vars vars matrix_xmulti_pltexpa2 linearmulti(matrix_xmulti_pltexpa2) cell %matrix_subproblem_pltexpa2_benchmark bench matrix_subproblem_pltexpa2 avg(recourse(matrix_xfirst_pltexpa2, matrix_subproblem_pltexpa2, matrix_of_scenarios_pltexpa2_6)) double %matrix_subproblem_pltexpa2_data data matrix_subproblem_pltexpa2 avg(recourse(matrix_xfirst_pltexpa2, matrix_subproblem_pltexpa2, matrix_of_scenarios_pltexpa2_6)) double %matrix_subproblem_pltexpa2_vars vars matrix_subproblem_pltexpa2 avg(recourse(matrix_xfirst_pltexpa2, matrix_subproblem_pltexpa2, matrix_of_scenarios_pltexpa2_6)) cell %matrix_of_scenarios_pltexpa2_6_probability prob matrix_of_scenarios_pltexpa2_6 avg(recourse(matrix_xfirst_pltexpa2, matrix_subproblem_pltexpa2, matrix_of_scenarios_pltexpa2_6)) double %matrix_of_scenarios_pltexpa2_6_data data matrix_of_scenarios_pltexpa2_6 avg(recourse(matrix_xfirst_pltexpa2, matrix_subproblem_pltexpa2, matrix_of_scenarios_pltexpa2_6)) double %matrix_of_scenarios_pltexpa2_6_vars vars matrix_of_scenarios_pltexpa2_6 avg(recourse(matrix_xfirst_pltexpa2, matrix_subproblem_pltexpa2, matrix_of_scenarios_pltexpa2_6)) cell %vector_l_pltexpa2_data data vector_l_pltexpa2 Constraint: >= vector_l_pltexpa2, <= vector_u_pltexpa2 double %vector_u_pltexpa2_data data vector_u_pltexpa2 Constraint: >= vector_l_pltexpa2, <= vector_u_pltexpa2 double %parameter_bound_data data parameter_bound Box: >= parameter_bound, <= parameter_bound_1 double %parameter_bound_1_data data parameter_bound_1 Box: >= parameter_bound, <= parameter_bound_1 double % %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\Stochastic Two Stage Linear Problem\data_problem_twostage_pltexpa2_6_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_xfirst_pltexpa2_data,matrix_xfirst_pltexpa2_vars,matrix_xmulti_pltexpa2_benchmark,matrix_xmulti_pltexpa2_data,matrix_xmulti_pltexpa2_vars,matrix_subproblem_pltexpa2_benchmark,matrix_subproblem_pltexpa2_data,matrix_subproblem_pltexpa2_vars,matrix_of_scenarios_pltexpa2_6_probability,matrix_of_scenarios_pltexpa2_6_data,matrix_of_scenarios_pltexpa2_6_vars,vector_l_pltexpa2_data,vector_u_pltexpa2_data,parameter_bound_data,parameter_bound_1_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);