AMPL - PowerPoint PPT Presentation

1 / 38
About This Presentation
Title:

AMPL

Description:

Consider that instead of one store you have three stores in different parts of the country ... You own an auto company and are setting up operation in a new country ... – PowerPoint PPT presentation

Number of Views:395
Avg rating:3.0/5.0
Slides: 39
Provided by: william164
Category:
Tags: ampl | advanced | auto | parts

less

Transcript and Presenter's Notes

Title: AMPL


1
AMPL
  • A Mathematical
  • Programming Language
  • Presentation 3

2
Outline
  • Set operations
  • Set indexing
  • Advanced syntax
  • Example

3
Set Operations
4
Set Operations
  • Let A, B, and U be sets
  • AMPL allows simple set operations
  • Union U A union B
  • Intersection U A inter B
  • Cross Product U A , B
  • These operations become useful or necessary in
    many problems

5
Advantage of Set Operations
  • Suppose we have 3 sets of products,
  • CANDY
  • TOYS
  • GAMES
  • In our model we may need to declare the following
    parameters for each
  • Price
  • Supply
  • Demand

6
NaĂŻve Setup
  • Param Price_C CANDY
  • Param Price_T TOYS
  • Param Price_G GAMES
  • Param Supply_C CANDY
  • Param Supply_T TOYS
  • Param Supply_G GAMES
  • Param Demand_C CANDY
  • Param Demand_T TOYS
  • Param Demand_G GAMES

7
Using Set Operation Union
  • Param Price CANDY union TOYS union GAMES
  • Param Supply CANDY union TOYS union GAMES
  • Param Demand CANDY union TOYS union GAMES

8
Even Better
  • Set PRODUCTS
  • CANDY union TOYS union GAMES
  • Param Price PRODUCTS
  • Param Supply PRODUCTS
  • Param Demand PRODUCTS

9
Compound Sets
  • Suppose you have a set called PRODUCTS of
    products to sell at a store
  • Consider that instead of one store you have three
    stores in different parts of the country
  • Each store has a different level of each paramater

10
One Solution
  • Instead of using the set PRODUCTS, make three
    different sets
  • PRODUCTS_1
  • PRODUCTS_2
  • PRODUCTS_3
  • Let each of the three numbers represent one of
    your store locations

11
One Solution (cont)
  • Next, define each parameter for each set of
    products
  • Param Price PRODUCTS_1
  • Param Supply PRODUCTS_1
  • Param Demand PRODUCTS_1
  • Param Price PRODUCTS_2
  • Param Supply PRODUCTS_2

12
Easier Solution
  • For a better solution use compound sets
  • Param Price PRODUCTS, STORES
  • Param Supply PRODUCTS, STORES
  • Param Demand PRODUCTS, STORES

13
Structure of PRODUCTS, STORES
  • Suppose
  • PRODUCTS oreos jenga lazertag
  • STORES 1 2 3
  • Then PRODUCTS, STORES is the set of all
    combinations of products with stores
  • (oreos,1) (oreos,2) (oreos,3)
  • (jenga,1) (jenga,2) (jenga,3)
  • (lazertag,1) (lazertag,2) (lazertag,3)

14
Specifying Data
  • In your .dat file, your declaration of Demand
    could look like this
  • param Demand 1 2 3
  • oreos 10 20 30
  • jenga 30 33 42
  • lazertag 40 30 22

15
Set Indexing
16
Indexing of Sets
  • Indexing of a one dimensional set
  • sum i in PRODUCTS costimakei
  • Indexing is similar in compound sets
  • One can say
  • sum (i,j) in PRODUCTS, STORES
    costimakei,j
  • or
  • sum i in PRODUCTS, j in STORES
    costimakei,j

17
When do we need indexing?
  • We may declare a parameter with or without giving
    index values
  • param Demand PRODUCTS, STORES
  • or
  • param Demand i in PRODUCTS, j in STORES

18
With PRODUCTS and STORES
  • The sales at each store will not exceed the
    demand for any given product at that store.
  • Could be expressed as the following constraint
  • subject to DEMAND (i,j) in PRODUCTS, STORES
  • Demand i,j Sell i,j

19
With PRODUCTS and STORES
  • Suppose we have another parameter
  • Param Capacity STORES
  • Let the capacity of a store be the total number
    of items it can sell all together

20
With PRODUCTS and STORES
  • The total sales at any given store can not
    exceed the sales capacity of that store.
  • Could be expressed as follows
  • Subject to CAPACITY j in STORES
  • Sum i in PRODUCTS Sell i, j

21
Advanced Syntax
  • Tips and Shortcuts

22
Transposition
23
How to Transpose
  • Recall an earlier example
  • Param Demand 1 2 3
  • oreos 10 20 30
  • jenga 30 33 42
  • lazertag 40 30 22

24
How to Transpose
  • Data in Transposed form
  • Param Demand (tr) oreos jenga lazertag
  • 1 10 30 40
  • 2 20 33 30
  • 3 30 42 22

25
Why Transpose
  • Not Necessary, but can help with data management
  • What if we had 30 stores?
  • Param Demand (tr) oreos jenga lazertag
  • 1 10 30 40
  • 2 20 33 30
  • 3 30 42 22

26
Omitted Data
27
Omitted Data Entry
  • Example Consider the following data
  • Param Cost Supply Demand
  • oreos 10 20 30
  • jenga 30 33 42
  • lazertag 40 30 22

28
Omitted Data Entry
  • Suppose in addition to the data specified in the
    previous table, you have an additional parameter
    such as
  • Param Calories FOOD
  • This parameter would apply to oreos, but not to
    jenga or lazertag.

29
Example
  • Param Cost Supply Demand
  • oreos 10 20 30
  • jenga 30 33 42
  • lazertag 40 30 22
  • Param Calories
  • oreos 100

30
Example
  • Param Cost Supply Demand Calories
  • oreos 10 20 30 100
  • jenga 30 33 42 .
  • lazertag 40 30 22 .
  • We can use . to represent omitted data

31
Example Problem
  • Auto Production

32
Auto Production
  • You own an auto company and are setting up
    operation in a new country
  • You want to decide which facilities to build and
    which cars to produce
  • You want to maximize your profit after one year

33
Cars and Buildings
  • You can make three types of cars
  • Sedan
  • Hybrid
  • Sport
  • There are two different types of car production
    plants
  • Standard Car Plant
  • High Tech Sport Plant

34
Cars and Buildings
  • There are two types of engine plants
  • Standard Engine Plant
  • Hybrid Engine Plant
  • An advanced tech center is required for some
    technologies

35
Cost, Selling Price, Market
36
Building Cost
37
(No Transcript)
38
Final Details
  • Due to labor limitations you can produce no more
    than 5000 cars in the first year
  • Your goal is to maximize profit
Write a Comment
User Comments (0)
About PowerShow.com