The Solution
After solving the model, you'll find that the expected value of the penalty function is approximately 2.78:
Global optimal solution found.
Objective value: 2.775631
Infeasibilities: 0.000000
Total solver iterations: 1092
You will recall that the penalty function used in the model's objective is a weighted combination of 4 times the dollars under target minus the number of dollars over target. So, does the positive expected objective value mean that we miss our target on average? Perhaps not, given that we weight the under target dollars 4 times more than the over target dollars. To get a more meaningful result, a calc section was added to the model:
CALC:
@SET( 'TERSEO', 1);
@SOLVE();
I = 1;
NOVER = 0;
NUNDER = 0;
@WRITE( ' Surplus ');
@FOR( TIME( T) | T #GT# @INDEX( T0): @WRITE( ' ', TIME( T)));
@WRITE( @NEWLINE( 1));
@WRITE( ' Scenario Return Prob');
@FOR( TIME( T) | T #GT# @INDEX( T0): @WRITE( ' Bond Stock'));
@WRITE( @NEWLINE( 1));
X_SURPLUS = 0;
@WHILE( I #LE# @SPNUMSCENE():
@SPLOADSCENE( I);
@WRITE( @FORMAT( I, '10.0f'), @FORMAT( OVER - UNDER, '15.3f'),
@FORMAT( @SPPRBSCENE( I), '10.3f')
);
@FOR( TIME( T) | T #GT# @INDEX( T0): @FOR( ASSETS( A): @WRITE( ' ',
@FORMAT( 100*(RETURN( A, T) - 1), '4.1f'), '%')));
@WRITE( @NEWLINE( 1));
X_SURPLUS = X_SURPLUS + @SPPRBSCENE( I) * ( OVER - UNDER);
I = I + 1;
@IFC( UNDER #LE# 1.E-8:
NOVER = NOVER + 1;
@ELSE
NUNDER = NUNDER + 1;
);
);
@WRITE( @NEWLINE( 1));
@WRITE( ' Expected surplus: ', @FORMAT( X_SURPLUS, '15.3f'));
@WRITE( @NEWLINE( 1));
@WRITE( ' Scenarios over goal: ', @FORMAT( NOVER, '12g'));
@WRITE( @NEWLINE( 1));
@WRITE( ' Scenarios under goal: ', @FORMAT( NUNDER, '11g'));
@WRITE( @NEWLINE( 1));
@WRITE( ' Success ratio: ', @FORMAT( NOVER/(NOVER+NUNDER), '18.3f'));
ENDCALC
This calc section uses the scripting capabilities in LINGO to generate a custom report that displays each of the 512 scenarios in the model, their return values and their expected surpluses of funds over the goal. (More details on LINGO scripting capabilities may be found in Chapter 13, Programming LINGO.) The report also lists summary information on the expected surplus dollars, along with the number of scenarios over target and the number below target. Portions of this report follow:
Surplus T1 T2 T3
Scenario Return Prob Bond Stock Bond Stock Bond Stock
1 0.528 0.002 11.0% 35.4% 13.3% 7.7% 9.5% 0.3%
2 14.604 0.002 11.0% 35.4% 13.3% 7.7% 11.9% 17.9%
3 12.203 0.002 11.0% 35.4% 13.3% 7.7% 11.0% 14.9%
4 27.423 0.002 11.0% 35.4% 13.3% 7.7% 11.6% 33.9%
5 18.706 0.002 11.0% 35.4% 13.3% 7.7% 12.9% 23.0%
<...>
500 9.946 0.002 12.7% 23.3% 11.4% 0.5% 11.6% 33.9%
501 3.249 0.002 12.7% 23.3% 11.4% 0.5% 12.9% 23.0%
502 -7.809 0.002 12.7% 23.3% 11.4% 0.5% 12.3% 5.3%
503 -4.413 0.002 12.7% 23.3% 11.4% 0.5% 12.3% 10.8%
504 1.961 0.002 12.7% 23.3% 11.4% 0.5% 13.2% 20.9%
505 6.928 0.002 12.7% 23.3% 12.8% 27.7% 9.5% 0.3%
506 22.123 0.002 12.7% 23.3% 12.8% 27.7% 11.9% 17.9%
507 19.531 0.002 12.7% 23.3% 12.8% 27.7% 11.0% 14.9%
508 35.960 0.002 12.7% 23.3% 12.8% 27.7% 11.6% 33.9%
509 26.551 0.002 12.7% 23.3% 12.8% 27.7% 12.9% 23.0%
510 11.241 0.002 12.7% 23.3% 12.8% 27.7% 12.3% 5.3%
511 15.953 0.002 12.7% 23.3% 12.8% 27.7% 12.3% 10.8%
512 24.741 0.002 12.7% 23.3% 12.8% 27.7% 13.2% 20.9%
Expected surplus: 4.413
Scenarios over goal: 344
Scenarios under goal: 168
Success ratio: 0.672
Based on this report, we see that the expected surplus is $4,413, meaning that on average we can expect to meet our goal by that amount. Furthermore, 344 of the 512 scenarios ended over target for a success ratio of 67.2%.