LINGO is a mathematical modeling language designed for formulating and solving optimization PRoblems, including linear, integer, and nonlinear programming problems. It is small but powerful.
This tutorial is a sample introduction to how to use lingo to solve some basic optimization problems. And this is the first essay of it.
Of course, we need lingo. But I just find lingo13 for linux, so this tutorial is based on it…Click here to download After you download it, you can extract the gz
file and the Readme.pdf
will tell you how to install lingo13 in you computer.
Create an empty document in the folder lingo13, and type:
MODEL:TITLE LP;[OBJ] MAX=2*x+3*y;[c1] 4*x+3*y<10;[c2] 3*x+5*y<12;ENDthen save it as sam.lng
. Open the terminal in the folder lingo13 and type $ bin/linux64/lingo13
to launch lingo13, then use$ take sam.lng
and$ go
to execute the sam.lng
. And the program will solve the LP and give you the answer:
when you see these lines, it means lingo have solved the problem. Model Class: LP
tells you that this is a Linear Programing problem,and Objective value: 7.454545
gives you the optimal value of objective function. Variable
and Value
show exactly the optimal solution.
Congratulations! You achieve the most difficult part of the tutorial. Hope you can enjoy lingo13 and see you next time:-)
新闻热点
疑难解答