/// <summary> /// Calculates the fitness value of the given solution. /// </summary> public override float Calculate(TSPTWProblem problem, IEnumerable <int> tour, out int violated, out float violatedTime, out float waitTime, out float time, ref bool[] validFlags) { // calculate everything here. violated = problem.TimeAndViolations(tour, out time, out waitTime, out violatedTime, ref validFlags); // here only violated time is usefull, this objective is built to only make a tour valid. return(violatedTime); }
/// <summary> /// Calculates the fitness value of the given solution. /// </summary> public override float Calculate(TSPTWProblem problem, IEnumerable <int> tour, out int violated, out float violatedTime, out float waitTime, out float time, ref bool[] validFlags) { // calculate everything here. violated = problem.TimeAndViolations(tour, out time, out waitTime, out violatedTime, ref validFlags); // TODO:there is need to seperate the violations, waiting time and weights. // expand the logistics library to allow for pareto-optimal or other // more advanced weight comparisons. // => this may not be needed anymore for the TSP-TW but for other problems it may be useful. return(time + violatedTime * 1000); }
/// <summary> /// Calculates the fitness of a TSP solution. /// </summary> /// <returns></returns> public sealed override float Calculate(TSPTWProblem problem, IEnumerable <int> solution) { if (_validFlags == null) { _validFlags = new bool[problem.Times.Length / 2]; } // calculate everything here. float violatedTime, time, waitTime; var violated = problem.TimeAndViolations(solution, out time, out waitTime, out violatedTime, ref _validFlags); // here only violated time is usefull, this objective is built to only make a tour valid. return(violatedTime); }
/// <summary> /// Calculates the fitness value of the given solution. /// </summary> public sealed override float Calculate(TSPTWProblem problem, Tour solution) { if (_validFlags == null) { _validFlags = new bool[solution.Count]; } // calculate everything here. float violatedTime, waitTime, time; var violated = problem.TimeAndViolations(solution, out time, out waitTime, out violatedTime, ref _validFlags); // TODO:there is need to seperate the violations, waiting time and weights. // expand the logistics library to allow for pareto-optimal or other // more advanced weight comparisons. // => this may not be needed anymore for the TSP-TW but for other problems it may be useful. return(time + violatedTime * 1000); }