Program execution
If you have followed the standard installation procedure of Python and the xpress package, you can run this file with the following command:
python Folio.py
Running the program generates the following output:
Maximizing LP Folio using up to 20 threads and up to 31GB memory, with these control settings: OUTPUTLOG = 1 NLPPOSTSOLVE = 1 XSLP_DELETIONCONTROL = 0 XSLP_OBJSENSE = -1 Original problem has: 3 rows 10 cols 19 elements Presolved problem has: 3 rows 10 cols 19 elements Presolve finished in 0 seconds Heap usage: 396KB (peak 410KB, 85KB system) Coefficient range original solved Coefficients [min,max] : [ 1.00e+00, 1.00e+00] / [ 1.00e+00, 1.00e+00] RHS and bounds [min,max] : [ 3.00e-01, 1.00e+00] / [ 3.00e-01, 1.00e+00] Objective [min,max] : [ 5.00e+00, 3.10e+01] / [ 5.00e+00, 3.10e+01] Autoscaling applied standard scaling Its Obj Value S Ninf Nneg Sum Dual Inf Time 0 42.600000 D 2 0 .000000 0 5 14.066667 D 0 0 .000000 0 Uncrunching matrix Optimal solution found Dual solved problem 5 simplex iterations in 0.00 seconds at time 0 Final objective : 1.406666666666666e+01 Max primal violation (abs/rel) : 0.0 / 0.0 Max dual violation (abs/rel) : 0.0 / 0.0 Max complementarity viol. (abs/rel) : 0.0 / 0.0 Problem status: Solve status: COMPLETED Sol status: OPTIMAL Total return: 14.066666666666665 frac(0) : 30.00 % frac(1) : 0.00 % frac(2) : 20.00 % frac(3) : 0.00 % frac(4) : 6.67 % frac(5) : 30.00 % frac(6) : 0.00 % frac(7) : 0.00 % frac(8) : 13.33 % frac(9) : 0.00 %
The upper half of this display is the log of Xpress: the size of the matrix, 3 rows (i.e. constraints) and 10 columns (i.e. decision variables), and the log of the LP solution algorithm (in this case, `D' for dual Simplex). The lower half is the output produced by our program: the maximum return of 14.067 is obtained with a portfolio consisting of shares 0, 2, 4, 5, and 8. 30% of the total amount are spent in shares 0 and 5 each, 20% in 2, 13.33% in 8 and 6.67% in 4. It is easily verified that all constraints are indeed satisfied: we have 50% of North American shares (0 and 2) and 33.33% of high-risk shares (2 and 8).
It is possible to modify the amount of output that is printed by adding the following line before the start of the optimization:
p.controls.outputlog = 0
This setting disables all output (including warnings) from Xpress, with the exception of error messages. The possible values for the printing level range from 0 to 4.
© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.