Optimization Of A Nonlinear Equation Using AMPL

+1

No comments posted yet

Comments

Slide 5

# PART 1 DECLARATION OF VARIABLES (variables, parameters, sets etc) var x >= 0; var y >= 0; var z >= 0; # PART 2 OBJECTIVE FUNCTION: name and mathematical expression minimize Objfunc: x^2+y^2+z^2; # PART 3 CONSTRAINTS: names and corresponding mathematical expressions subject to GOne: x+y+3*z=2; subject to GTwo: 5*x+2*y+z=5;

Slide 1

Optimization of a Nonlinear Equation Using AMPL Erol Selitektay

Slide 2

The Softwares You Need AMPL Student Version (Download link: http://www.ampl.com/DOWNLOADS/index.html) Notepad++ (Download link: notepad-plus-plus.org/download) Note:Actually, you do not need Notepad++. You can use any source code editor . But i would like to use Notepad++ and i used it for this tutorial.

Slide 3

Set Up AMPL Unzip amplcml.zip to amplcml folder. And that’s it. You do not need any installation process.

Slide 4

The Nonlinear Equation Which We Will Solve Min. function f(x,y,z) = x² + y² + z² Subject to  g₁(x,y,z) = x+y+3z=2 g₂(x,y,z) = 5x + 2y + z = 5

Slide 5

Writing AMPL Code Run Notepad++ and write the codes

Slide 6

Saving The File Save the file as demo.mod If you do not want to specify the path, you must save the .mod file into amplcml. Because amplcml contains the sw.exe and the solvers.

Slide 7

AMPL Command Window Double Click ampl which in amplcml folder.

Slide 8

Load Model To load our model we should type in the AMPL command window : model demo.mod; Note: If you do not save the .mod file in amplcml file, you have to specify the path like this : model C:\path\to\model.mod;

Slide 9

Solve The Model To solve the model type: solve;

Slide 10

Display The Result Once the problem is solved we can display the result and values. To display result type : display Objfunc; Note: Remember that our object function name is Objfunc.

Slide 11

Display Variable Values To display the variable values just type the variables names: display x, y, z;

Slide 12

The End This is very basic approach to solving nonlinear equation. Of course you can solve the equation using lagrange multipliers. So you can verify the result. To get more information about nonlinear equations and optimization visit : http://iacs.seas.harvard.edu/courses/am205/AM205_unit_4_chapter_1.pdf Thank You

Summary: Optimization Of A Nonlinear Equation Using AMPL

Tags: ampl nonlinear optimization math equation

URL: