mobook / MO-book

Hands-On Optimization with Python
MIT License
145 stars 39 forks source link

Markowitz conic constraint #60

Closed glebbelov closed 10 months ago

glebbelov commented 1 year ago

In 06/markowitz-portfolio-reviisted.ipynb, the mathematical model says <=s, but Pyomo goes <=s^2. Obviously mistyped, moreover it does not run with Mosek.

Moreover in the AMPL version of the notebook we add the following comment in the Python code, after the hint how to derive Sigma:

# Moreover, in practive such a matrix A, called factor, can be low-rank,
# see https://docs.mosek.com/modeling-cookbook/qcqo.html#example-factor-model.
# This would provide better numerical properties for the proper conic formulation
#        y=Ax, |y|^2 <= s,
# corresponding to the mathematical formulation above.
alessandrozocca commented 10 months ago

Thanks for catching the typo, it is now been corrected and is <=s consistently in the model and in the code. The comment about the matrix A has also been added.