[AMPL 24620] change the solver using loop

Hope all is well.

I want to compare the performance of a lot of different solvers in ampl so I tried these commands in the console. However, it did not work. Is there any other way to avoid setting up the solver repeatedly?

set SOLVERS = {“minos”, “baron”, “gurobi”};
model ‘ex1.mod’;
data ‘ex1.dat’;
for {i in SOLVERS}{
option solver i;
display result >> output.txt;


This question has been answered in our new, enhanced user forum at https://discuss.ampl.com.