G53CLP Constraint Logic Programming - PowerPoint PPT Presentation

About This Presentation
Title:

G53CLP Constraint Logic Programming

Description:

G52AIP. Artificial Intelligence Programming. Constraint Optimisation Problems ... Total cost is minimised, or within a limit. Total value is maximised ... – PowerPoint PPT presentation

Number of Views:126
Avg rating:3.0/5.0
Slides: 15
Provided by: rxq
Category:

less

Transcript and Presenter's Notes

Title: G53CLP Constraint Logic Programming


1
G53CLPConstraint Logic Programming
Dr Rong Qu
  • Constraint Optimisation Problems Demos in OPL
    Studio

2
SEND MORE MONEY - model
  • S E N D
  • M O R E
  • M O N E Y
  • Variables
  • Domain

3
SEND MORE MONEY - model
  • //.mod file
  • //declaration
  • //variables
  • enum Letters S, E, N, D, M, O, R, Y
  • //domain
  • var int lLetters in 0..9

4
SEND MORE MONEY - model
  • //.mod file
  • //declaration
  • //problem - constraints
  • solve
  • alldifferent(l) onDomain
  • lS ltgt 0
  • lM ltgt 0
  • ...

5
SEND MORE MONEY - model
  • //.mod file
  • //declaration
  • //problem - constraints
  • solve
  • ...
  • 1000lS 100lE 10lN lD
  • 1000lM 100lO 10lR lE
  • 10000lM 1000lO 100lN 10lE
    lY

6
SEND MORE MONEY - model
7
SEND MORE MONEY decision tree
8
SEND MOST MONEY model
  • S E N D
  • M O S T
  • M O N E Y
  • Variables
  • Domain

9
Smugglers Knapsack Problem
  • A smuggler has a knapsack of capacity 9
  • He can only make one trip
  • He can smuggle
  • Bottles of whisky size 4 profit 15
  • Bottles of perfume size 3 profit 10
  • Cartons of cigarettes size 2 profit 7
  • He wants
  • At least a profit of 30
  • Maximise the profit

10
Smugglers Knapsack Problem
  • Variables
  • W, P, C
  • Domain
  • 0, , 9
  • Constraints
  • 4W 3P 2C lt 9
  • 15W 10P 7C gt30

Bottles of whisky size 4 profit
15 Bottles of perfume size 3 profit
10 Cartons of cigarettes size 2 profit 7
11
Knapsack Problems
  • Which items should be put in the bag to maximise
    the profit

12
Knapsack Problems
  • General problems
  • Given a number of items with associated costs and
    values
  • Determine the collection of items so that
  • Total cost is minimised, or within a limit
  • Total value is maximised

13
Simple Assignment Problem
  • In a factory
  • 4 workers
  • 4 products
  • Profits of assigning workers to products
  • Each worker has one product
  • Each product is assigned to one worker
  • At least total profit gt 19

p1 p2 p3 p4
w1 7 1 3 4
w2 8 2 5 1
w3 4 3 7 2
w4 3 1 6 3
14
Simple Assignment Problem
  • Variables
  • li,j worker i assigned to product j
  • Domain
  • 0, 1
  • Constraints
  • sum (li) 1, i..4
  • sum (weighti,j li,j) gt 19
Write a Comment
User Comments (0)
About PowerShow.com