Search code examples
ampl

How do I change the default solver in AMPL?


AMPL by default uses MINOS. I have to type option solver "./lpsolve"; every time I want to use lpsolve as my solver. Is there a way to change the default?


Solution

  • Create a text file in the directory where AMPL and lpsolve is with the following line:

    option solver './lpsolve';

    Before running ampl, you have to set the OPTIONS_IN environment variable and make it point to this newly created text file. I am using bash and I gave the name settings.txt to this text file. Before calling ampl, I issue the following command in the bash shell:

    export OPTIONS_IN=./settings.txt

    There are others ways to do this, and you may use another shell so I don't want to expand on this.

    You may find useful the CPLEX user's guide. Even though it's for CPLEX, there are a few sections on ampl that generally apply.

    For example all the above I write is in this user's guide, see Chapter 4 Customizing AMPL, section Persistent Option Settings.