28
Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Embed Size (px)

Citation preview

Page 1: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Supply Chain Modeling Language for Optimization-Implementation in Python-

Mikio KUBOTokyo University of

Marine Science of Technology

Page 2: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Agenda

• What’s the SCML (Supply Chain Modeling Language)

• How to implement the SCML in Python

• (Applications)

Page 3: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

What is the SCML?

SCML

Supply Chain Optimization

Models

Combinatorial Optimization

Models

Solvers(using metaheuristics

and/or MIP/CP solvers)

SCML.py

proposed in 2009 by M. K. (international scheduling symposium)

Page 4: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Supply chain optimization models• resource constrained scheduling (RCS) • lot-sizing (LS)• logistics network design (LND)• safety stock allocation (SSA)• economic order quantity (EOQ)• inventory policy optimization (IPO)• vehicle routing (VR)

Page 5: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Combinatorial optimization problems• set covering problem (SC)• generalized assignment problem (GA)• rectangular packing problem (RP)• facility location problem (FL)• multi-constrained knapsack problem (MK)• graph coloring problem (GC)• graph partitioning problem (GP)• maximum stable set problem (MSS)• (constrained) bin packing problem (BP)• quadratic assignment problem (QA)

Page 6: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Previous SCO models

Flow models

(LND, FL)

Multi-echelon inventory models

(IPO, SSA, EOQ, LS)

Constrained optimization models

(Algebraic modeling languages)

Scheduling models

(RCS, LS, VR)

Page 7: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Previous SCO models

Flow models

(LND, FL)

Multi-echelon inventory models

(IPO, SSA, EOQ, LS)

Constrained optimization models

(Algebraic modeling languages)

Scheduling models

(RCS, LS, VR)

Network=(Node, Arc),Product Activity, Resource

Product (BOM)Variable, Constraint

Page 8: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Activity based view of linear programming

brow (constraint)=resource

matrix A=[aij]

column (variable) =activity Xj

++

system inputof resource

activity i consumes

resource j by aij

Dantzig-Wolfe (1963)

Page 9: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Problem class

C o n s t ra in t Va r ia b le

R e s o u rc e A c t iv i t y

P ro b le mGurobi (MIP)GLPK (MIP/Free)SCOP (CP)

Page 10: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Entities of the SCML

• activity • resource• product• node• arc

• temporal• piecewise• horizon• state• solver• etc., ...

Basic entities

Page 11: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Activity

• Every action that requires the resources, consumes and/or produces the product, and derives the cost

activity

resource

product productconsume produce

require

Fixed CostVariable Cost

Page 12: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Resource

• Every entity of limited availability required and/or consumed by activities

Our focus is on the physical, human, and financial resources.

Page 13: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Product

• Products are consumed and/or produced by activities

• Products are items or commodities through the network

activityproduct productconsume produce

Page 14: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Product

• Products are consumed and/or produced by activities

• Products are items or commodities through the network

node node

product product

arc

Page 15: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Node and arc

• Network is defined by the set of nodes and arcs

node nodearc

Page 16: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Declaration and attributes

• activity• resource• product• node• arc

activity declaration activity activity-name [attributes]

attribute:

duedate integer+

weight integer+

consume product-name unit real+ ...

produce product-name unit real+ ...

...

Page 17: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Key concepts for implementing the SCML in Python• Inheritance / Composition

• Hierarchy

• Global / Local

Page 18: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Inheritance

Page 19: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Entity class

Entity has a name and attributes (defined by arguments as a dictionary)

class Entity(): def __init__(self, name="",**args):

self.name=name

self.attributes=copy.deepcopy(args)

Page 20: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

An activity object for LSact1=Activity("act1",

variablecost=1, fixedcost=53,,leadtime=3, resources={"res1":1},consume={"parts1":1,"parts2":2},produce={"prod1":1})

Class Activity(Entity):

prod1

resource

activity

consume

produce

parts1

parts2

Page 21: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Composition

Page 22: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Hierarchy

• Hierarchy can be defined on every entity using attribute “children”

• Every attribute of a parent is copied to its children (same as inheritance)

activity

Mode Mode Modechildren

Page 23: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Example: an activity object for RP

item1=Activity("item1”, cost=10, childrenchildren=“mode1": {resources:{"width":3,"height":2}} ,“mode2”: {resources={"width":2,"height":3}, cost=5})

mode1(cost=10)

mode2(cost=5)

Page 24: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Global / Local• Local products can be defined on nodes

• Local activities and resources can be defined on arcs, i.e., arcs can own activities and resources

• Otherwise, entities are called global.

activity

resource

product productconsume produce

require

node nodearc

Page 25: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Lot-sizing (LS) model

• horizon, activity, resource, product

product

resource

activity

consume

produce

product

Page 26: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Example for solving LS in python (1)from SCML import * #import everything from SCML modulesample=SCML() #generate SCML class objectsample.setHorizon(5) #set the planning horizon to 5#generate the product class objectsprod1=Product("prod1",demand=[5,5,6,7,8],

holdingcost=5,leadtime=1)parts1=Product("parts1",holdingcost=1,leadtime=3)parts2=Product("parts2",holdingcost=1,leadtime=1) #generate the resource class objectres1=Resource(“res1”,capacity={(0,“inf”):25})

Page 27: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Example for solving LS in python (2)#generate the activity class object

act1=Activity("act1",variablecost=1,fixedcost=53,resources={"res1":1},consume={"parts1":1,"parts2":2},generate={"prod1":1})

#add the generated objects into the problem class

sample.addActivity(act1)

sample.addProducts(prod1,parts1,parts2)

sample.addResource(res1)

sample.solve(“LS”) #solve by the lot-sizing solver

Page 28: Supply Chain Modeling Language for Optimization -Implementation in Python- Mikio KUBO Tokyo University of Marine Science of Technology

Future plans

• Applications (hybrid models)– Lot-sizing + Inventory policy optimization

– Logistics network design + Resource constrained scheduling +Lot-sizing

• Excel interface for beginners

• A book on the SCML (will be published in 2010-11 from Asakura Publishers)