public override Statistics run() { Environment env = new Environment(); //dist List<double> valueList = new List<double>() { 1, 2, 3, 4, 5 }; List<double> distribution = new List<double>() { 0.5, 0.6, 0.7, 0.8, 1.0 }; Discrete d = new Discrete(valueList, distribution); //dist1 Uniform n = new Uniform(1, 3); Distribution dist = new Distribution(d); Distribution dist1 = new Distribution(n); Create c = new Create(env, 0, 20, dist); Dispose di = new Dispose(env, 1); Queue q = new Queue(env, 3); q.Capacity = 1; Resource r = new Resource(env, 2, 1, dist1, q); c.Next_AID.Add("First", 2); r.Next_AID.Add("First", 1); env.System_Time = new DateTime(1970, 1, 1, 0, 0, 0); env.Start_Time = new DateTime(1970, 1, 1, 0, 0, 0); env.Setup_Simulation(); return env.Simulate(); }
public double run() { Environment env = new Environment(); //dist for Create Constant Const = new Constant(1); Distribution CreateDist = new Distribution(Const); //distributions for Inventory List<double> States = new List<double>() { 1, 2, 3 }; //1 for good, 2 for fair, 3 for poor List<double> States_Prob = new List<double>() { 0.35, 0.80, 1.00 }; Discrete StatesDisc = new Discrete(States, States_Prob); List<double> State1 = new List<double>() { 40, 50, 60, 70, 80, 90, 100 }; List<double> State1_Prob = new List<double>() { 0.03, 0.08, 0.23, 0.43, 0.78, 0.93, 1.00 }; Discrete State1Disc = new Discrete(State1, State1_Prob); List<double> State2 = new List<double>() { 40, 50, 60, 70, 80, 90, 100 }; List<double> State2_Prob = new List<double>() { 0.10, 0.28, 0.68, 0.88, 0.96, 1.00, 1.00 }; Discrete State2Disc = new Discrete(State2, State2_Prob); List<double> State3 = new List<double>() { 40, 50, 60, 70, 80, 90, 100 }; List<double> State3_Prob = new List<double>() { 0.44, 0.66, 0.82, 0.94, 1.00, 1.00, 1.00 }; Discrete State3Disc = new Discrete(State3, State3_Prob); Dictionary<double, Discrete> Demand = new Dictionary<double, Discrete>(); Demand.Add(1, State1Disc); Demand.Add(2, State2Disc); Demand.Add(3, State3Disc); List<Int64> Amount = new List<Int64>(); for (int i = 0; i < 20; i++) Amount.Add(70); Create create = new Create(env, 0, 20, CreateDist, Amount); Dispose dispose = new Dispose(env, 2); Inventory inv = new Inventory(env, 1, new TimeSpan(1), 70, StatesDisc, Demand, 0.33, 0.50, true, 0.05); create.Next_AID.Add("First", 1); inv.Next_AID.Add("First", 2); env.System_Time = new DateTime(1970, 1, 1, 0, 0, 0); env.Start_Time = new DateTime(1970, 1, 1, 0, 0, 0); env.Setup_Simulation(); env.Simulate(); double sumOfProfit = 0; for (int i = 1; i <= 20; i++) sumOfProfit += (double)inv.Statistics.OtherStatistics[i][5].StatisticValue; return sumOfProfit; }
public void run() { Environment env = new Environment(); // List<double> valueList = new List<double>() { 1, 2, 3, 4, 5 }; List<double> distribution = new List<double>() { 0.5, 0.6, 0.7, 0.8, 1.0 }; Discrete discrete = new Discrete(valueList, distribution, 0); // Uniform uniform = new Uniform(1, 3, 0); Distribution CreateDist = new Distribution(discrete); Distribution ResDist = new Distribution(uniform); Create c = new Create(env, 0, 4, CreateDist); Dispose dispose = new Dispose(env, 10); Queue q = new Queue(env, 5); q.Capacity = 10; Resource r = new Resource(env, 1, 1, ResDist, q); Queue q2 = new Queue(env, 6); q2.Capacity = 10; Resource r2 = new Resource(env, 2, 1, ResDist, q2); Queue q3 = new Queue(env, 7); q3.Capacity = 10; Resource r3 = new Resource(env, 3, 1, ResDist, q3); Queue q4 = new Queue(env, 8); q4.Capacity = 10; Resource r4 = new Resource(env, 4, 1, ResDist, q4); c.Next_AID.Add("First", 1); r.Next_AID.Add("First", 2); r2.Next_AID.Add("First", 3); r3.Next_AID.Add("First", 4); r4.Next_AID.Add("First", 2); env.System_Time = new DateTime(1970, 1, 1, 0, 0, 0); env.Start_Time = new DateTime(1970, 1, 1, 0, 0, 0); env.Setup_Simulation(TimeSpan.FromSeconds(300)); env.Simulate(); }
public override Statistics run() { Environment env = new Environment(); //dist for Create Uniform CreateDist = new Uniform(1, 5); //dist for Able Uniform AbleDist = new Uniform(4, 6); //dist for Baker Uniform BakerDist = new Uniform(2, 5); Distribution DistCreate = new Distribution(CreateDist); Distribution DistAble = new Distribution(AbleDist); Distribution DistBaker = new Distribution(BakerDist); Create create = new Create(env, 0, 100, DistCreate); Dispose dispose = new Dispose(env, 10); Queue SharedQueue = new Queue(env, 3); Resource Able = new Resource(env, 1, 1, DistAble, SharedQueue); Resource Baker = new Resource(env, 2, 1, DistBaker, SharedQueue); Decide decide = new Decide(env, 5); //Condition EQCond cond = new EQCond(0, Able, Actor.StateType.Idle); decide.AddCondition(cond, Able.AID); decide.AddElse(Baker.AID); create.Next_AID.Add("First", 5); Able.Next_AID.Add("First", 10); Baker.Next_AID.Add("First", 10); env.System_Time = new DateTime(1970, 1, 1, 0, 0, 0); env.Start_Time = new DateTime(1970, 1, 1, 0, 0, 0); env.Setup_Simulation(); return env.Simulate(); }
public void run() { Environment env = new Environment(); //dist List<double> valueList = new List<double>() { 1, 2, 3, 4, 5 }; List<double> distribution = new List<double>() { 0.5, 0.6, 0.7, 0.8, 1.0 }; Discrete d = new Discrete(valueList, distribution, 0); //dist1 Uniform n = new Uniform(1, 3, 0); Distribution dist = new Distribution(d); Distribution dist1 = new Distribution(n); Create c = new Create(env, 0, 10000, dist,null,new List<double>(){0.3,0.8,1.0}); Dispose di = new Dispose(env, 1); Queue q = new Queue(env, 3); q.Capacity = 1; Resource r = new Resource(env, 2, 1, dist1, q); Queue q2 = new Queue(env,5); q2.Capacity = 1; Resource r2 = new Resource(env, 6, 1, dist1, q2); Queue q3 = new Queue(env, 10); q3.Capacity = 1; Resource r3 = new Resource(env, 7, 1, dist1, q3); c.Next_AID.Add("First", 2); c.Next_AID.Add("Second", 6); c.Next_AID.Add("Third", 7); r.Next_AID.Add("First", 1); r2.Next_AID.Add("First", 1); r3.Next_AID.Add("First", 1); env.System_Time = new DateTime(1970, 1, 1, 0, 0, 0); env.Start_Time = new DateTime(1970, 1, 1, 0, 0, 0); env.Setup_Simulation(); env.Simulate(); }
public void run() { Environment env = new Environment(); //dist Uniform d = new Uniform(1, 1, 0); //dist1 Uniform n = new Uniform(5, 5, 0); Distribution dist = new Distribution(d); Distribution dist1 = new Distribution(n); Create c = new Create(env, 0, 10, dist); Dispose di = new Dispose(env, 10); Queue q = new Queue(env, 3); q.Capacity = 10; Resource r = new Resource(env, 1, 1, dist1, q); Queue q2 = new Queue(env, 4); q2.Capacity = 5; Resource r2 = new Resource(env, 2, 1, dist1, q); Decide de = new Decide(env, 5); //Condition EQCond cond = new EQCond(0, r, Actor.StateType.Busy); de.AddCondition(cond, r2.AID); de.AddElse(r.AID); c.Next_AID.Add("First", 5); r.Next_AID.Add("First", 10); r2.Next_AID.Add("First", 10); env.System_Time = new DateTime(1970, 1, 1, 0, 0, 0); env.Start_Time = new DateTime(1970, 1, 1, 0, 0, 0); env.Setup_Simulation(); env.Simulate(); /////// }