Changeset 15507 for branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3
- Timestamp:
- 12/11/17 15:42:12 (7 years ago)
- Location:
- branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Evaluation/GQAPNMoveEvaluator.cs
r15506 r15507 130 130 131 131 MoveEvaluationParameter.ActualValue = moveEvaluation; 132 MoveQualityParameter.ActualValue = new DoubleValue(problemInstance.ToSingleObjective(moveEvaluation)); 132 133 return base.Apply(); 133 134 } -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment-3.3.csproj
r15504 r15507 102 102 <Compile Include="GQAPAssignment.cs" /> 103 103 <Compile Include="GQAPInstance.cs" /> 104 <Compile Include="Interfaces\Parameter\IAssignmentAwareGQAPOperator.cs" /> 104 105 <Compile Include="Operators\Crossovers\CordeauCrossover.cs" /> 105 106 <Compile Include="SolutionCreators\SlackMinimizationSolutionCreator.cs" /> -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Operators/LocalImprovers/ApproximateLocalSearch.cs
r15506 r15507 106 106 /// <param name="maximumIterations">The maximum number of iterations that should be performed each time the candidate list is generated.</param> 107 107 /// <param name="problemInstance">The problem instance that contains the data.</param> 108 /// <param name="evaluatedSolutions">The number of evaluated solutions.</param> 108 109 /// <param name="oneMoveProbability">The probability for performing a 1-move, which is the opposite of performing a 2-move.</param> 109 110 public static void Apply(IRandom random, IntegerVector assignment, 110 111 DoubleValue quality, ref Evaluation evaluation, IntValue maxCLS, IntValue maximumIterations, 111 GQAPInstance problemInstance, PercentValue oneMoveProbability) {112 GQAPInstance problemInstance, IntValue evaluatedSolutions, PercentValue oneMoveProbability) { 112 113 var capacities = problemInstance.Capacities; 113 114 var demands = problemInstance.Demands; 114 //var weights = problemInstance.Weights; 115 //var distances = problemInstance.Distances; 116 //var installationCosts = problemInstance.InstallationCosts; 115 var evaluations = 0.0; 116 var deltaEvaluationFactor = 1.0 / assignment.Length; 117 117 while (true) { 118 118 int count = 0; … … 126 126 127 127 var moveEval = GQAPNMoveEvaluator.Evaluate(move, assignment, evaluation, problemInstance); 128 evaluations += move.NewAssignments.Count * deltaEvaluationFactor; 128 129 double moveQuality = problemInstance.ToSingleObjective(moveEval); 129 130 130 if (moveEval.ExcessDemand <= 0.0 && moveQuality < 0.0) {131 if (moveEval.ExcessDemand <= 0.0 && moveQuality < quality.Value) { 131 132 CLS.Add(Tuple.Create(move, moveQuality, moveEval)); 132 133 sum += 1.0 / moveQuality; … … 135 136 } while (CLS.Count < maxCLS.Value && count < maximumIterations.Value); 136 137 137 if (CLS.Count == 0) 138 if (CLS.Count == 0) { 139 evaluatedSolutions.Value += (int)Math.Ceiling(evaluations); 138 140 return; // END 139 else {141 } else { 140 142 var ball = random.NextDouble() * sum; 141 143 var selected = CLS.Last(); … … 148 150 } 149 151 NMoveMaker.Apply(assignment, selected.Item1); 150 quality.Value += selected.Item2;152 quality.Value = selected.Item2; 151 153 evaluation = selected.Item3; 152 154 } … … 163 165 MaximumIterationsParameter.ActualValue, 164 166 ProblemInstanceParameter.ActualValue, 167 EvaluatedSolutionsParameter.ActualValue, 165 168 OneMoveProbabilityParameter.ActualValue); 166 169 EvaluationParameter.ActualValue = evaluation;
Note: See TracChangeset
for help on using the changeset viewer.