Having problem when using the Matlab APi

I’m having problems when following the instructions in the Initial Setup section of the MATLAB API document(AMPL MATLAB API — AMPL API 2.1.4 documentation). After running setupOnce, I go on to the firstExample function without specifying solver. Then I got the following result.


Then, after I request the MINOS and update my license, I specified the solver minos like firstExample(minos), and I got
image
I tried to use another solver IPOPT, but it seemed that IPOPT cannot be invoked.

I don’t know where I went wrong, could you please tell me how to deal with this problem? Thank you very much.

Hi @HammerDog,

You need to pass the solver name as a string (e.g., firstExample("ipopt")), or modify the MATLAB script to set the solver with ampl.setOption("solver", "ipopt");.

Your advice is very helpful, I have already solved my problem, thank you very much!

How to use matlab and ampl together

Every time you use this api, run setupOnce.m once in the folder where the setupOnce file is located. So you may need to set the current path to this folder. I’m a beginner too, I hope my advice is useful.

1 Like

I’m a beginner too,thanks