Api questions about matlab

I don’t understand how the api works. First I installed ampl.exe, which contains the API file

When I tested the API according to the documentation, it worked


But when I used an ampl file written by someone else, it calculated and went wrong. This file is as follows, there is also an ampl.exe. I think this case should be the path setting is not correct or the environment variable is not correct, because I delete the path of matlab will appear different situations, ampl solution can run a little longer. That is, different paths and environment variable Settings, using the same code, ampl solution will appear different situationsso how to set it


Autonomous_Intersection_Management-master.zip (2.7 MB)

Hi @liangzilu_liangzilu,

Do you have more than one AMPL instalation? If that is the case it is possible that you are running using different versions of AMPL and/or IPOPT. Nevertheless, that “exit value …” message indicates that IPOPT crashed. You need to report the bug to the IPOPT developers or try with a different solver such as Knitro.

Yes, I installed an ampl myself and downloaded other people’s files with an ampl. Do these files conflict in one folder?

The API will use the first AMPL installation found in the environment variable PATH. So in case there are two installations it then depends on which one is used. You can specify the AMPL installation to use with ampl = AMPL(“C:/complete/path/to/ampl/installation/folder”) every time you instantiate an AMPL object.