Description

MATLAB code

Results

Table 1. Solution report

 

 

Description

Case study Relative Entropy Minimization (see Formal Problem Statement) in MATLAB Environment is solved with riskprog PSG subroutine.

 

Main MATLAB code is in file CS_Entropyr.m.

Data are saved in file Data_CS_Entropyr.mat.

 

MATLAB code

Let us describe the main operations. To run case study you need to do the following main steps:

 

In file CS_Entropyr.m:

 

Load data from file Data_CS_Entropyr.dat containing matrices p, Aeq, and vectors beq, lb,ub:

 

load 'Data_CS_Entropyr';

 

Set solver options:

 

stroptions.Linearization = 'On';

stroptions.Precision = 9;

stroptions.Solver = 'BULDOZER';

 

The first option invokes linearization of objective (CS.1), which speeds up calculations (in this particular case). The second option specifies the correct number of digits the solver tries to achieve in objective and constraints. The third option specifies the solver type.

 

Optimize problem:

 

[p_res, fval, status, output] = riskprog ('entropyr', [], p', [],[],[],[],[], Aeq , beq, lb,[], '', stroptions);

 

 

Display information about optimal solution

 

fprintf('Data loading time = %f sec.\n', output.data_loading_time);

fprintf('Preprocessing time = %f sec.\n', output.preprocessing_time);

fprintf('Solving time = %f sec.\n', output.solving_time);

fprintf('Objective value from Riskprog = %.10f\n', fval);

 

 

Calculate the Relative Entropy function  to check the obtained result:

 

val_optimal = 0.0;

for i=1:I

   val_optimal = val_optimal + p_res(i)*log(p_res(i)/p(i));

end

 

Display verification result:

 

fprintf('Objective calculated for verification = %.10f\n', val_optimal);

 

Results

Table 1. Solution report

 

Data loading time = 1.730000 sec.

Preprocessing time = 1.200000 sec.

Solving time = 1.270000 sec.

Objective value from Riskprog = 1.9230682010

Objective calculated for verification = 1.9230682010