generalized bpp

28
Generalized BPP Guido Perboli ([email protected]) DAUIN - Politecnico di Torino

Upload: hallam

Post on 05-Feb-2016

108 views

Category:

Documents


0 download

DESCRIPTION

Generalized BPP. Guido Perboli ([email protected]) DAUIN - Politecnico di Torino. Problem. Set of items Volume v i Set of bins Maximum loadable volume V j Cost c j Use the mix of containers of minimum cost All the items are loaded - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Generalized BPP

Generalized BPP

Guido Perboli ([email protected])DAUIN - Politecnico di Torino

Page 2: Generalized BPP

2 Generalized BPP

Problem

Set of itemsVolume vi

Set of binsMaximum loadable volume Vj

Cost cj

Use the mix of containers of minimum costAll the items are loadedFor each used bin, the volume of the items is at most the maximum loadable volume

Page 3: Generalized BPP

3 Generalized BPP

Formulation

otherwise

jy

jix

j

ij

0

used is bin 1

otherwise0

bin in loaded item1

Jjy

JjIix

ix

jyVxv

ts

ycMin

j

ij

Jjij

jjIi

iji

Jjjj

}1,0{

,}1,0{

1

..

Page 4: Generalized BPP

4 Generalized BPP

LB for GBPP

Consider to continuously load the itemsChoose the bins such that the volume of the bins is at least the total volume of the itemsWe can write this problem as a minimization Knapsack (Min KP)

Consider the bins as the items in the Min KPConsider as the size of the Knapsack the total volume of the GBPP items

Page 5: Generalized BPP

5 Generalized BPP

LB for GBPP

otherwise0

used is bin 1 jy j

Jjy

jvyV

ts

ycMin

j

Iii

Jjjj

Jjjj

}1,0{

..

Page 6: Generalized BPP

6 Generalized BPP

LB for GBPP

We have a lot of specific codes to solve the Max KPWe can rewrite the Min KP as a Max KP

Substitute zj=1-yj

zj is 1 if the bin is not used

Page 7: Generalized BPP

7 Generalized BPP

LB for GBPP

otherwise0

usednot is bin 1 jz j

Jjz

jvzV

ts

zcMin

j

Iii

Jjjj

Jjjj

}1,0{

)1(

..

)1(

Page 8: Generalized BPP

8 Generalized BPP

LB for GBPP

Jjz

jvzV

ts

zcMax

j

Iii

Jjjj

Jjjj

}1,0{

)1(

..

)1(

JjjTot

Iijtot

j

Iiitot

Jjjj

TotJj

jj

cC

VV

Jjz

jvVzV

ts

CzcMax

}1,0{

..

Page 9: Generalized BPP

9 Generalized BPP

UB for the GBPP: BFD heuristics

Order the bins by non-decreasing costs (and non-increasing volume if the costs are equal)Order the items by non-increasing volumesFor each item i

Load i in the best partially loaded binIf i cannot be loaded in any bin

Add a new bin and load i in it

Page 10: Generalized BPP

10 Generalized BPP

Shopkeeper Algorithm Scheme

Init Sol byConstructive Heur.

Init ScoresSort Attributes

by Score

Constructive Heur

StoppingConditions

Update ScoresReinit Scores

Non ImprovingIter. Limit

Exit

New Solution

Local Search Yes

Yes

No

No

Page 11: Generalized BPP

11 Generalized BPP

What do you have to define?

Stopping criteriaCommon: max 1 second of CPU per instanceOthers: to be defined

Scoring initializationAs in the example (given by the loading of the initial solution)Optional: redefine it

Short term updateStart with your assignmentsModify them in order to obtain the best results

Long term update (optional)

Page 12: Generalized BPP

Short Term Update description

Page 13: Generalized BPP

13 Generalized BPP

Hypothesis

Item 1 first element in the item listNumber of items NNumber of Bins in the solution B

Page 14: Generalized BPP

14 Generalized BPP

Sliding

B/2 :Mfor valueInital

)(,1*

)(,1*

Msbs

Msbss

ii

iii

Page 15: Generalized BPP

15 Generalized BPP

Grasp- Like

Already implemented in the online codeCycling on all the items:

i: current item,Randomly choose an item k between i and i+If k in not i, swap the scores of i and k

Page 16: Generalized BPP

16 Generalized BPP

Substring Swap

Choose an item i between item 1 and MM is a parameter, initially set to N/2

Choose an item j between item M+1 and NFor k=0 to

Swap the scores of item i+k and j+kis another parameter (initial value 3)

Page 17: Generalized BPP

17 Generalized BPP

Substring Swap 2

Choose an item i between item 1 and MM is a parameter, initially set to N/2

Choose an item j between item M+1 and NFor k=0 to

Swap the scores of item i+k and j+-kis another parameter (initial value 3)

Page 18: Generalized BPP

18 Generalized BPP

Worst Bins First

Get the k worst bins (initial value 3) Bins with largest residual space Increase the scores of the items in these

bins the best scoring by a parameter (initial value 0.3)

Page 19: Generalized BPP

19 Generalized BPP

Best Bins Last

Get the k best bins (initial value 3) Bins with smallest residual space Decrease the scores of the items in these

bins the best scoring by a parameter (initial value 0.3)

Page 20: Generalized BPP

Some remarks on the source code

Page 21: Generalized BPP

21 Generalized BPP

Work material & Laboratories

CodeVisual Studio 2005 solution fileInstance dataBatch to make the tests (prove_totali.bat)

Page 22: Generalized BPP

22 Generalized BPP

Executable parameters

-if instancefile-lf logfile (log the main data in csv format compatible with Excel

Example-if data\monaci\prob_1_A_0_4.txt -lf miolog.csv

Page 23: Generalized BPP

23 Generalized BPP

Core code

All the instance data are in mydataAll the method-based data are in kpGlobalDatacomputeLBKnapsack: compute the LBcomputeBFD: compute the BFD solution

First parameter: mydataSecond parameter: list of items pointer

computeBFDFromLbCompute an UB intializing the list of the bins with the bins given by the LB

Page 24: Generalized BPP

24 Generalized BPP

Additional code

copySolution: function that copies a solution on another (the two pointers must be already allocaed)Common defines

File commonDefines.h_MYDEBUG_

If not commented, activate the debug code (you must recompile)

_MYDEBUG_SOLIf not commented, activate the usage of the isFeasible member of the solution class in order to check if a solution is formally correct

computeBFDGraspFunction using a GRASP like BFD heuristic where the item list is randomly perturbed

Page 25: Generalized BPP

25 Generalized BPP

Page 26: Generalized BPP

26 Generalized BPP

Warnings

When you move your files on another computer you can have problems due to subversions of the libraries

Page 27: Generalized BPP

27 Generalized BPP

How to compile in release mode

Page 28: Generalized BPP

28 Generalized BPP

How to debug