Sunday, October 5, 2008

AMPL/Linux - Setting Environment Variables

If your PATH environment variable doesn't contain the path to the solvers, AMPL complains that it couldn't find the solver:
ampl: option solver minos;
ampl: solve;
Cannot invoke minos: No such file or directory
exit code 4
You need to add the path to the solver executables in the PATH:
export PATH="$PATH":/home/user/.../Solvers
Similarly, if your model contains an external function you need to set the environment variable AMPLFUNC. It should be pointing at the shared object file (i.e., amplfunc.so), or the directory which contains this file.
export AMPLFUNC=/home/user/.../AMPL/amplfunc.so