I am a Postdoctoral Research Fellow with The SUTD-MIT International Design Centre (IDC), Singapore University of Technology and Design (SUTD). My research topic is about protocol and algorithm design, resource allocation and localisation in wireless sensor network, UAV network and Ad Hoc network. I also enjoy the mobile programming (Android and Objective-C) and web server development. Thanks for sharing.
Feb 27, 2013
AMPL optimization tool on Mac OS
AMPL is a mathematical programming language. It can be downloaded from http://www.ampl.com/DOWNLOADS/index.html. There are some useful solvers as well. http://www.ampl.com/DOWNLOADS/details.html. Most of them require student ident.
After you download or install AMPL and those solvers, you need to use command "chmod +x ..." to convert them to executable program on Mac.
Then, you must edit environment variables (in ~/.bashrc file) to add ampl and related libraries/licenses.
export PATH=...:/your/AMPL/path/ampl
export DYLD_LIBRARY_PATH=/your/knitro/path/lib
export ZIENA_LICENSE=/your/knitro/license/path
For the testing of AMPL, we create a file named as myprog.mod and write a simple model,
var XB;
var XC;
maximize Profit: 25 * XB + 30 * XC;
subject to Time: (1/200) * XB + (1/140) * XC <= 40;
subject to B_limit: 0 <= XB <= 6000;
subject to C_limit: 0 <= XC <= 4000;
Then, change directory to the myprog.mod file. type ampl on the command prompt and we can try to solve it by different solvers. (the default solver of AMPL is MINOS)
1) ampl: model myprog.mod;
ampl:option solver knitroample;
ampl:solve;
2) ampl: model myprog.mod;
ampl:option solver gurobi;
ampl:solve;
3) ampl: model myprog.mod;
ampl:solve;
4) ampl: model myprog.mod;
ampl:option solver lpSolve;
ampl:solve;
5) ampl: model myprog.mod;
ampl:option solver snopt;
ampl:solve;
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment