abbas

Views:
 
Category: Entertainment
     
 

Presentation Description

No description available.

Comments

Presentation Transcript

AMPL: 

AMPL Mohammad Abbas Salman Aziz Uzair Siddique 30/6/2011

Introduction: 

Introduction Mathematical programming is a technique for solving certain kinds of problems , notably maximizing profits and minimizing costs, subject to constraints on resources, capacities, supplies, demands, and the like AMPL is a language for specifying such optimization problems

EXAMPLE: 

EXAMPLE A firm produces three products. These products are processed on three different machines. The time required to manufacture one unit of each of the three products and the daily capacity of the three machines are given in the table

Slide 4: 

Machine Time per Unit(min) Machine capacity Min/day Product 1 Product 2 Product 3 M1 2 3 2 440 M2 4 - 3 470 M3 5 5 - 430

Slide 5: 

It is required to determine the daily number of units to be manufactured for each product. The profit per unit for product 1, 2 and 3 is Rs.4 Rs.3 and Rs.6. It is assumed that all amounts produced are consumed in the market.

SOLUTION : 

SOLUTION First of all open the note pad and create the following file: Step 1 (Declaration of Variable) Var x_1>=0 Var x_2>=0 Var x_3>=0

Slide 7: 

Step 2 (Objective function) Maximize profit : 4*x_1 + 3*x_2 + 6*x_3; Step 3 (Constraints) Subject to machine 1: 2*x_1 + 3*x_2 + 2*x_3 <=440; Subject to machine 2: 4*x_1 + 3*x_3 <=470;

Slide 8: 

Subject to machine 3: 2*x_1 + 5*x_2 <=430; Then save the file with name “simplemodel.txt” in your choice location. Then open the ampl file and select the “swe” Write “model <path>/simplemodel.txt;”

Slide 9: 

Path refers to the location of your save file. After loading the file type “save;” Display x_1, x_2, x_3;

EXAMPLE 2: 

EXAMPLE 2 Columbia Candies Factory produces two flavors of chewing gum: mint and cinnamon. The mint flavor gum is sold for $1 per package, while the cinnamon gum is sold for $1.5 per package. The company has limited resources and can produce only one flavor of gum at a time. The rates of production are different; the company can produce 40 package of mint gum per hour but only 30 packages of cinnamon gum per hour. Considering the result of a marketing study, the company decided that at most it can sell 900 packages of cinnamon gum and 1000 packages of mint gum. If we consider that a week has 40 hours of labor and we have no storage capacity, we need to determine how many packages of mint and cinnamon gum we should produce so that the total revenue is maximized.

SOLUTION: 

SOLUTION # PART 1 DECLARATION OF VARIABLES (variables, parameters, sets etc) var x_c >= 0; var x _m >= 0; # PART 2 OBJECTIVE FUNCTION: name and mathematical expression maximize revenue: x_ m + 1.5*x _c; # PART 3 CONSTRAINTS: names and corresponding mathematical expressions subject to Aval -Time: (1/40)*x_m+(1/30)*x _c<=40; subject to Max -Mint: x _m<=1000; subject to Max- Cinn: x _c<=900;

Slide 12: 

Then open swe in ampl folder and write model C:\Users\example1.mod; Type solve; display x_ c, x _m;

Slide 13: 

THANK YOU