generalized bpp guido perboli dauin - politecnico di torino

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

Upload: darcy-griffin

Post on 19-Jan-2018

214 views

Category:

Documents


0 download

DESCRIPTION

3 Generalized BPP Formulation

TRANSCRIPT

Generalized BPP

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

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

3 Generalized BPP

Formulation

otherwisej

y

jix

j

ij

0used is bin 1

otherwise0bin in loaded item1

Jjy

JjIix

ix

jyVxv

ts

ycMin

j

ij

Jjij

jjIi

iji

Jjjj

}1,0{

,}1,0{

1

..

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

5 Generalized BPP

LB for GBPP

otherwise0

used is bin 1 jy j

Jjy

jvyVts

ycMin

j

Iii

Jjjj

Jjjj

}1,0{

..

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

7 Generalized BPP

LB for GBPP

otherwise0

usednot is bin 1 jz j

Jjz

jvzVts

zcMin

j

Iii

Jjjj

Jjjj

}1,0{

)1(..

)1(

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{

..

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

10 Generalized BPP

Shopkeeper Algorithm Scheme

Init Sol byConstructive Heur.

Init Scores Sort Attributesby Score

Constructive Heur

StoppingConditions

Update ScoresReinit Scores

Non ImprovingIter. Limit

Exit

New Solution

Local Search Yes

Yes

No

No

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)

Short Term Update description

13 Generalized BPP

Hypothesis

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

14 Generalized BPP

Sliding

B/2 :Mfor valueInital

)(,1*)(,1*

MsbsMsbs

sii

iii

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

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)

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)

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)

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)

Some remarks on the source code

21 Generalized BPP

Work material & Laboratories

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

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

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

24 Generalized BPP

Additional codecopySolution: 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

25 Generalized BPP

26 Generalized BPP

Warnings

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

27 Generalized BPP

How to compile in release mode

28 Generalized BPP

How to debug