public Inventory(Environment env, Int64 Id, TimeSpan Period, Int64 Level, Discrete State, Dictionary<double, Discrete> Demand, double PricePerUnit, double SalePricePerUnit, bool Salvage, double ScrapPricePerUnit, List<double> CumulativeNext = null) : base(env, Id, CumulativeNext) { this.Period = Period; this.StateProb = State; if (Demand.Keys.Count != State.Probabilities.Count) throw new Exception("Demand Probabilities have problem in assigning"); this.DemandProb = Demand; this.Level = Level; this.PricePerUnit = PricePerUnit; this.SalePricePerUnit = SalePricePerUnit; this.ScrapPricePerUnit = ScrapPricePerUnit; this._salvage = Salvage; this._statistics = new ResourceStatistic(); this.Env.InventoryStatistics.Add(this.Statistics); }
public void CallNext(Entity E) { if (this.CumulativeNext != null && this.CumulativeNext.Count != this.Next_AID.Count) this.CumulativeNext = null; if (this.CumulativeNext != null) { NextDiscrete = new Discrete(this.Next_AID.Values.ToList(), this.CumulativeNext); } if (NextDiscrete != null) { Int64 nextAID = NextDiscrete.NextLong(); Actor NextActor = Env.Sim_Actors[nextAID]; NextActor.GenerateEvent(E); } else { Actor NextActor = Env.Sim_Actors[Next_AID.First().Value]; NextActor.GenerateEvent(E); } }