Example: cdarmulti_dev(0.65,matrix_4,matrix_51). Parameter = 0.65

matrix_4:

 

x1

x2

x4

scenario_benchmark

2

-3

0

-2

-1

6

11

5

1

-7

-3

9

15

-1

40

7

 

matrix_51:

 

x1

x2

x3

x4

scenario_benchmark

1

7

2

0

4

5

8

3

8

4

1

4

3

6

0

9

2

11

6

10

 

at point_1:

 

component_name

value

x1

x2

x3

x4

1

1

1

1

 

MATLAB code (.\Aorda\PSG\MATLAB\Examples\Func_value_cdarmulti_dev.m) for function calculation:

 

addpath('..')

%Define data:

H1 = [2 -1 1;-3 6 -7;0 11 -3;-2 5 9];

header_1 = {'x1', 'x2', 'x4'};

c1 = [15;-1;40;7];

H2 = [1 4 8 3;7 5 4 6;2 8 1 0;0 3 4 9];

header_2 = {'x1', 'x2', 'x3', 'x4'};

c2 = [2;11;6;10];

a = [1;1;1;1];

%Define data:

H1 = [2 -1 1;-3 6 -7;0 11 -3;-2 5 9];

header_1 = {'x1', 'x2', 'x4'};

c1 = [15;-1;40;7];

H2 = [1 4 8 3;7 5 4 6;2 8 1 0;0 3 4 9];

header_2 = {'x1', 'x2', 'x3', 'x4'};

c2 = [2;11;6;10];

a = [1;1;1;1];

alpha = 0.65;

%=======================================================================

%Calculation of function with PSG Subroutine 'tbpsg_function_value'

%Create the PSG matrix 'matrix_1'(structure containing header and matrix body) and pack it to structure 'toolboxstruc_arr':

toolboxstruc_arr(1) = tbpsg_matrix_pack('matrix_1', H1, header_1, c1, []);

%Create the PSG matrix 'matrix_2'(structure containing header and matrix body) and pack it to structure 'toolboxstruc_arr':

toolboxstruc_arr(2) = tbpsg_matrix_pack('matrix_2', H2, header_2, c2, []);

%Create the PSG point 'point_1'(structure containing header and matrix body) and pack it to structure 'toolboxstruc_arr':

toolboxstruc_arr(3) = tbpsg_point_pack('point_1', a, []);

%Create the PSG parameter 'parameter_alpha' and pack it to structure 'toolboxstruc_arr':

toolboxstruc_arr(4) = tbpsg_parameter_pack('parameter_alpha', alpha);

%Calculate cdarmulti_dev function with parameter 0.65 at point 'point_1':

val1 = tbpsg_function_value('cdarmulti_dev(parameter_alpha,matrix_1,matrix_2)','point_1',toolboxstruc_arr);

%Display function value:

disp(sprintf('tbpsg_function_value = %g', val1));

%=======================================================================

%Creation of User Subroutine for calculating function value

%User subroutine is similar to the 'functionvalue'

%Create problem statement:

problem_statement = sprintf('%s\n',...

'calculate',...

'Point: point_1',...

'  cdarmulti_dev(parameter_alpha,matrix_1,matrix_2)',...

' ');

%Create Subroutine:

tbpsg_create_user_subroutine(problem_statement,toolboxstruc_arr,'.\','calculate_cdarmulti_dev');

%Uncomment section to call the user subroutine 'calculate_cdarmulti_dev':

%{

%Calculation of function with User Subroutine 'calculate_cdarmulti_dev':

[solution_str,outargstruc_arr] = calculate_cdarmulti_dev(H1,header_1,c1,H2,header_2,c2,a,point_1_vars,alpha);

%Extract function value from the solution report:

val = tbpsg_function_data(solution_str, outargstruc_arr);

%}

 

Program output:

 

tbpsg_function_value = 24.0714

 

This function can't be evaluated with PSG Subroutine 'functionvalue' because input matrices include different variables