public override Solution Run() { Log($"Assign a path for each train ... ", Utils.Logging.LogEventArgs.MessageType.Info, false); if (CurrentSolution.AssignPaths()) { Log($"done.", Utils.Logging.LogEventArgs.MessageType.Success); } else { Log($"failed.", Utils.Logging.LogEventArgs.MessageType.Error); } // Only one iteration for this solver { Log(HorizontalLine); Log($"Loop on trains and assign entry-exit times ... "); var usedResources = new UsedResourceCollection(); ScheduleTrains(CurrentProblem, CurrentSolution.TrainRunsDic.Values.OrderBy(tr => tr.Train.MinEntryEarliest), usedResources); var validation = CurrentSolution.Validate(); if (CurrentSolution.IsAdmissible) // Only consider admissible solution { Log($"Compute objective function ... "); CurrentSolution.ComputeObjectiveFunction(); CompareWithBest(CurrentSolution); } else { Log(validation); } } return(BestSolution); }
public override void Init(ProblemInstance problem) { base.Init(problem); CurrentSolution.AssignPaths(); OrderedTrainRuns = CurrentSolution.TrainRunsDic.Values.OrderBy(tr => tr.Train.MinEntryEarliest).ThenBy(tr => tr.Train.MaxDelayPenalty).ToArray(); }
public override void Init(ProblemInstance problem) { base.Init(problem); Log($"Assign a path for each train ... "); CurrentSolution.AssignPaths(); // Schedule every train without considering conflicts in resource occupation Log($"Schedule each train without considering resource occupation ... ", Utils.Logging.LogEventArgs.MessageType.Info, false); BasicSchedule(CurrentSolution.TrainRunsDic.Values.OrderBy(tr => tr.Train.MinEntryEarliest).ThenBy(tr => tr.Train.MaxDelayPenalty)); Log("done.", Utils.Logging.LogEventArgs.MessageType.Success); }