Cannot invoke cplex in amplapi for matlab

Error occurs as “Cannot invoke cplex: no such program.” When I’m using the amplapi for matlab.

In the file, I have specified the full path of ampl folder as:
ampl = AMPL(‘D:\ampl’);

What shall I do?

Hi @YUE,

Thank you for reaching out. Could you please send us a screenshot showing the contents of D:\ampl?

Hi @YUE,

Based on the file timestamps it looks like an old AMPL version and if D:\AMPL is not in the environment variable Path, you need to provide the full path to the solver (e.g., ampl.setOption('solver', 'D:\ampl\cplex.exe');).

We would, however, recommend adding D:\ampl\ to the environment variable Path, which would also allow instantiating AMPL objects with just ampl = AMPL().