Sure, but I don’t think that is the problem. Otherwise the model couldn’t be run.

In that PATH there is “/usr/local/lib/python3.10/dist-packages/ampl_module_base/bin:/usr/local/lib/python3.10/dist-packages/ampl_module_gurobi/bin” which is a module with AMPL and another with Gurobi. To avoid confusion, you can uninstall them as follows:

from amplpy import modules

modules.uninstall()

Since there are no modules now, it must use the version installed in that directory but it is not being able to find AMPL there. Could you please send us a screenshot showing the contents of that directory and the path to it?

Looking again at that screenshot, is this on Google Colab? On Google Colab you cannot access your local installation of AMPL. You need to download the jupyter notebook and run it locally to to exactly the same binaries you have installed on your local machine.

Alternatively, in order to run locally on the same version that runs on Colab, you can update your local installation with https://portal.ampl.com/dl/amplce/amplide.macos64.tgz

This will allow you to see the output of your existing scripts on the latest version of AMPL and Gurobi (the same versions that run on Colab).

Hello,

I’m trying to solve an optimization problem using amplpy and gurobi and I’m getting this output which includes some warnings:

does this mean that the problem has not been solved properly?

Sincerely,

Fargol

Computers operate with finite-precision numbers. This usually implies certain amount of roundoff errors.

Your objective value is 18647821.62 which is about 2E+07. Recomputed objective value differs by 3E-06, which means that 12 digits are correct. This is fine for most practical cases (all printed digits of the objective are correct).

Hello,

I’m running an ampl model on amplpy and I’m receiving the following warnings; I checked the warnings online and it seems that they happen when there are lower bounds defined for a variable that are larger than the upper bounds.

However, I don’t have lower bounds in my model at all. I’ve only defined x >=0.

Please note that when I run the celll again. it tells me that the model in infeasible.

Can you help me resolve these warnings?

Even though you only set >= 0 bounds on the variables, the constraints may impose further constraints resulting in some imposing an upper bound lower than the lower bound imposed by other constraints. This happens when the model is infeasible. In order to figure out why the model is infeasible you can use the IIS (irreducible infeasible subsystem) feature of Gurobi as follows:

ampl = AMPL()

ampl.eval(r"“”

var x >= 0;

var y >= 0;

s.t. c: x+y <= -5;

“”“)

ampl.option[“solver”] = “gurobi”

ampl.option[“gurobi_options”] = “iis=1” # set the IIS option for Gurobi

ampl.option[“presolve”] = 0 # disable AMPL presolve so that the problem is sent to Gurobi even if it is infeasible

ampl.solve()

ampl.get_data(”{i in 1…_ncons: _con[i].iis != 0} (_conname[i], _con[i].iis)").to_pandas() # retrieve the list of constraints that are part of the IIS.

The constraints in this last dataframe are a subset of constraints that cause infeasibility.