tbpsg_solution_struct function generates structure containing PSG solution reports in convenient MATLAB format.

 

Syntax

[output_structure] = tbpsg_solution_struct(solution_str, outargstruc_arr)

 

Description

[output_structure] = tbpsg_solution_struct(solution_str, outargstruc_arr) returns the structure with solution details of an optimization problem extracted from the solution reports solution_str and outargstruc_arr reported by tbpsg_run.

 

Input Arguments

solution_str

string with solution report;

outargstruc_arr

array of output PSG data structures.

 

Output Arguments

output_structure

structure with solution details in convenient format.

 

Fields of output_structure:

 

status

status of the solved optimization problem = optimal / feasible / infeasible / calculated;

objective

value of objective;

function_name

names of functions;

function_value

values of functions;

vector_function_name

names of vector functions;

vector_function_value

values of vector functions;

time

[solving_time, data_loading_time, preprocessing_time];

optimal_point_data

components of optimal point;

optimal_point_vars

cell array with strings from header of optimal point;

point_constraints_data

values of constraints;

point_constraints_vars

names of constraints;

point_slack_data

values of slacks of constraints; names of constraints are stored in field point_constraints_vars;

point_dual_data

values of dual constraints; names of constraints are stored in field point_constraints_vars;

vector_constraints_data

sell array with values of constraints in the case of vector constraint;

vector_slack_data

sell array with values of slacks in the case of vector constraint;

vector_dual_data

sell array with values of dual constraints in the case of vector constraint;

matrix_data

matrices numerical data;

matrix_vars

cell array with strings from headers of matrices;

vector_data

vectors numerical data (except vectors of constraints).

 

Example

CVaR problem is defined in section Quick Start with PSG Toolbox.

Open PSG Toolbox:

 

>> tbpsg_toolbox

 

Load in PSG Toolbox problem from file   .\Aorda\PSG\MATLAB\Examples\Toolbox\problem_cvar.mat

Open in PSG Toolbox menu "Save to Workspace" and save problem statement and toolbox structure to Workspace variables problem_statement and toolboxstruc_arr (see Lesson 2. Solve Problem Programmatically).

 

Optimize problem using tbpsg_run:

 

[solution_str,outargstruc_arr]=tbpsg_run(problem_statement, toolboxstruc_arr);

 

Solution was saved to two MATLAB variables: solution_str = string containing report with solution details, outargstruc_arr = structure with optimal point.

Use the following function to save solution details in a structure in convenient format:

 

>> output_structure = tbpsg_solution_struct(solution_str, outargstruc_arr)

 

output_structure =

 

                    status: {'optimal'}

                      time: [0.2200 0 0]

                 objective: -4.3500

             function_name: {3x1 cell}

            function_value: [3x1 double]

      vector_function_name: {}

     vector_function_value: {}

        optimal_point_data: [0 0.6000 0.1900 0.2100]

        optimal_point_vars: {'x1'  'x2'  'x3'  'x4'}

     point_constraint_data: [4.5000 1.0000]

     point_constraint_vars: {'constraint_1'  'constraint_2'}

          point_slack_data: [0 -4.4409e-016]

           point_dual_data: [3.7037 -22.1111]

   vector_constraints_data: {}

         vector_slack_data: {}

          vector_dual_data: {}

               matrix_data: {}

               matrix_vars: {}

               vector_data: {}

 

>> output_structure.function_name

 

ans =

 

   'avg_g(matrix_scenarios)'

   'cvar_risk(0.95,matrix_scenarios)'

   'linear(matrix_budget)'

 

>> output_structure.function_value

 

ans =

 

   4.5000

  -4.3500

   1.0000

 

See also

tbpsg_solution, tbpsg_toolbox, tbpsg_vars, tbpsg_run