Closed glebbelov closed 1 year ago
@fdabrandao do we need the g parameter for tools.ampl_notebook? It is not self-explanatory and it fails for me:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[196], line 4
2 import numpy as np
3 import pandas as pd
----> 4 ampl = tools.ampl_notebook(
5 modules=["ipopt", "mosek"], # modules to install
6 license_uuid="default", # license to use
7 g=globals() ### --------- Fails for me. Can this be default, would anyone change it?
8 ) # instantiate AMPL object and register magics
TypeError: ampl_notebook() got an unexpected keyword argument 'g'
Hi @glebbelov,
You seem to have an outdated version of amplpy. Could you please run pyton -m install amplpy --upgrade
and try again?
That last argument is necessary to give access to the globals in the notebook and enabling %%ampl_eval
to access the global object named ampl
. It cannot be a default because globals()
returns the global variables accessible from where it is invoked, globals()
inside a module returns the globals inside that module.
ChatGPT told me that IPython.get_ipython().user_global_ns
gives me access to the global environment of the notebook too so that argument is going to go away in the next release.
@fdabrandao Concerning the Markowitz, the original notebook presents x' Sigma x <= s in the mathematical model, but then <= s^2 in Python. Changing model to <= s allows Mosek to be used. I am doing this in our notebook. Probably, authors should be notified about this mistake. Should I still add a model where the factorized matrix is used?
@fdabrandao SVM notebook did not run. I fixed general Python code. Should the authors be notified?
@glebbelov, for any errors you find in the original notebooks you can open issues at: https://github.com/mobook/MO-book/issues (they asked me to open issues there for any mistakes we find)
Use Ipopt, Mosek, Gurobi, Knitro to solve SOCP and exponential cones (Gurobi only SOCP). Progress status for text only:
Progress status for models: