//l2 public void UpdateItemPrices(Configuration configuration, IPricingUtilities PricingUtilities, string priceUpdatingRule) { /*if (Iter == MaxIter) * { * //goto end * * } * else * {*/ if (z > (Zstar / 2)) { PricingUtilities.ComputePricingUpdateRule(z, Items, TemporaryBins, priceUpdatingRule, "REGPART"); } if (z <= (Zstar / 2)) { PricingUtilities.ComputePricingUpdateRule(z, Items, TemporaryBins, priceUpdatingRule, "EXTRAPART"); } Iter += 1; //rimetto tutti gli item come isRemoved = false perché cominicio una nuova iterazione foreach (Item item in Items) { item.IsRemoved = false; } //goto l3 //EraseCurrentSolution(configuration); }
public void Initialize(Configuration configuration, string pricingRule, IPricingUtilities PricingUtilities) { Sequences = new List <Sequence> { new Sequence(), new Sequence() }; //inizializzo il prezzo v associato ad ogni item j Items = new List <Item>(); Bins = new List <Bin>(); Counter = 0; foreach (Dimension dimension in configuration.Dimensions) { Item item = new Item() { Height = dimension.Height, Width = dimension.Width, Id = Counter, Price = PricingUtilities.ComputePricingRule(pricingRule, dimension.Height, dimension.Width) }; Items.Add(item); //inserisco ogni item prezzato e i nuovi punti disponibili //in un bin diverso Bin bin = new Bin() { Id = Counter, Height = configuration.BinHeight, Width = configuration.BinWidth, NestedItems = new List <Item>() { item }, Points = new List <Position>() { new Position() { Pposition = 0, Qposition = item.Height, Rposition = 0, IsUsed = false }, new Position() { Pposition = 0, Qposition = item.Height, Rposition = 1, IsUsed = false }, new Position() { Pposition = item.Width, Qposition = 0, Rposition = 0, IsUsed = false }, new Position() { Pposition = item.Width, Qposition = 0, Rposition = 1, IsUsed = false } } }; Bins.Add(bin); Counter += 1; } //inizializzo il costo della soluzione con il numero degli elementi Zstar = Counter; //inizializzo il numero di iterazioni Iter = 0; //calcolo il lower bound ed il relativo intervallo //double lowerBound; MaxIter = configuration.MaxIter; }
public string CheckIfAllItemsAreAllocated(Configuration configuration, IUtilities Utilities, IPricingUtilities PricingUtilities, string itemAllocationMethod, IOutputUtilities OutputUtilities, string pricingRule, string priceUpdatingRule) { string res = ""; z = i; // K //============ TEST ============== LowerBound = Utilities.ComputeLowerBound(NotRemovedItems, configuration.BinWidth, configuration.BinHeight); NotRemovedItems.Clear(); if ((z + LowerBound) > Zstar) { //goto l2; //UpdateItemPrices(configuration, PricingUtilities, priceUpdatingRule); res = "UpdateItemPrices"; } //================================ bool isSortedTemporaryItemsEmpty = true; //controllo se tutta la lista è stata svuotata foreach (Item temporaryItem in TemporaryItems) { if (temporaryItem.IsRemoved == false) { isSortedTemporaryItemsEmpty = false; break; } } if (isSortedTemporaryItemsEmpty) { //goto l0; //UpdateBestSolution(OutputUtilities, itemAllocationMethod, pricingRule, priceUpdatingRule); res = "UpdateBestSolution"; } if (!isSortedTemporaryItemsEmpty) { i += 1; //l1 //FillUpBinI(itemAllocationMethod, Utilities); res = "FillUpBinI"; } return(res); }