Changeset 7478 for branches/GeneralizedQAP
- Timestamp:
- 02/16/12 16:00:07 (13 years ago)
- Location:
- branches/GeneralizedQAP
- Files:
-
- 2 added
- 2 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/GRASPWithPathRelinking.cs
r7438 r7478 27 27 using HeuristicLab.Data; 28 28 using HeuristicLab.Optimization; 29 using HeuristicLab.Optimization.Operators; 29 30 using HeuristicLab.Parameters; 30 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 79 80 get { return (ConstrainedValueParameter<ICrossover>)Parameters["PathRelinking"]; } 80 81 } 81 public ConstrainedValueParameter<I Merger> EliteSetMergerParameter {82 get { return (ConstrainedValueParameter<I Merger>)Parameters["EliteSetMerger"]; }82 public ConstrainedValueParameter<IPopulationReducer> EliteSetReducerParameter { 83 get { return (ConstrainedValueParameter<IPopulationReducer>)Parameters["EliteSetReducer"]; } 83 84 } 84 85 #endregion … … 109 110 get { return (RandomCreator)OperatorGraph.InitialOperator; } 110 111 } 112 private SolutionsCreator SolutionsCreator { 113 get { return (SolutionsCreator)RandomCreator.Successor; } 114 } 111 115 private GRASPWithPathRelinkingMainLoop MainLoop { 112 get { return RandomCreator.Successor as GRASPWithPathRelinkingMainLoop; }116 get { return SolutionsCreator.Successor as GRASPWithPathRelinkingMainLoop; } 113 117 } 114 118 #endregion … … 135 139 Parameters.Add(new FixedValueParameter<IntValue>("MinimumEliteSetSize", "(ρ) The minimum amount of elites for performing path relinking.", new IntValue(2))); 136 140 Parameters.Add(new ConstrainedValueParameter<ICrossover>("PathRelinking", "The operator that performs the path relinking.")); 137 Parameters.Add(new ConstrainedValueParameter<I Merger>("EliteSetMerger", "The operator that merges new solutions into theelite set."));141 Parameters.Add(new ConstrainedValueParameter<IPopulationReducer>("EliteSetReducer", "The operator that reduces the old elite set and the new solution(s) to a new elite set.")); 138 142 139 143 analyzer = new BestAverageWorstQualityAnalyzer(); 140 144 Analyzer.Operators.Add(analyzer); 141 145 142 RandomCreator randomCreator = new RandomCreator();146 var randomCreator = new RandomCreator(); 143 147 OperatorGraph.InitialOperator = randomCreator; 144 148 … … 149 153 randomCreator.SetSeedRandomlyParameter.Value = null; 150 154 155 var solutionsCreator = new SolutionsCreator(); 156 solutionsCreator.NumberOfSolutionsParameter.ActualName = MinimumEliteSetSizeParameter.Name; 157 solutionsCreator.ParallelParameter.Value = new BoolValue(true); 158 randomCreator.Successor = solutionsCreator; 159 151 160 var mainLoop = new GRASPWithPathRelinkingMainLoop(); 152 161 mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name; 153 mainLoop.EliteSet MergerParameter.ActualName = EliteSetMergerParameter.Name;162 mainLoop.EliteSetReducerParameter.ActualName = EliteSetReducerParameter.Name; 154 163 mainLoop.EliteSetSizeParameter.ActualName = EliteSetSizeParameter.Name; 155 164 mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions"; … … 158 167 mainLoop.PathRelinkingParameter.ActualName = PathRelinkingParameter.Name; 159 168 mainLoop.ResultsParameter.ActualName = "Results"; 160 randomCreator.Successor = mainLoop;169 solutionsCreator.Successor = mainLoop; 161 170 162 171 InitializeOperators(); … … 219 228 InitializeFromInstallation(LocalImprovementParameter, x => x.ProblemType.IsAssignableFrom(Problem.GetType())); 220 229 InitializeFromProblem(PathRelinkingParameter); 221 InitializeFromProblem(EliteSet MergerParameter);230 InitializeFromProblem(EliteSetReducerParameter); 222 231 } else { 223 232 LocalImprovementParameter.ValidValues.Clear(); 224 233 PathRelinkingParameter.ValidValues.Clear(); 225 EliteSet MergerParameter.ValidValues.Clear();234 EliteSetReducerParameter.ValidValues.Clear(); 226 235 } 227 236 Analyzer.Operators.Add(analyzer); … … 232 241 private void Parameterize() { 233 242 if (Problem != null) { 243 SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name; 244 SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name; 245 234 246 MainLoop.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name; 235 247 MainLoop.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name; … … 245 257 localImprovement.ResultsParameter.ActualName = "Results"; 246 258 } 247 foreach (var merger in EliteSetMergerParameter.ValidValues) { 248 merger.PopulationSizeParameter.ActualName = EliteSetSizeParameter.Name; 259 foreach (var reducer in EliteSetReducerParameter.ValidValues) { 260 reducer.MinimumPopulationSizeParameter.ActualName = MinimumEliteSetSizeParameter.Name; 261 reducer.MaximumPopulationSizeParameter.ActualName = EliteSetSizeParameter.Name; 249 262 } 250 263 } -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/GRASPWithPathRelinkingMainLoop.cs
r7412 r7478 61 61 get { return (IValueLookupParameter<IOperator>)Parameters["PathRelinking"]; } 62 62 } 63 public IValueLookupParameter<IOperator> EliteSet MergerParameter {64 get { return (IValueLookupParameter<IOperator>)Parameters["EliteSet Merger"]; }63 public IValueLookupParameter<IOperator> EliteSetReducerParameter { 64 get { return (IValueLookupParameter<IOperator>)Parameters["EliteSetReducer"]; } 65 65 } 66 66 public IValueLookupParameter<IOperator> AnalyzerParameter { … … 82 82 Parameters.Add(new ValueLookupParameter<IOperator>("LocalImprovement", "The operator which performs the local improvement.")); 83 83 Parameters.Add(new ValueLookupParameter<IOperator>("PathRelinking", "The operator which performs the path relinking.")); 84 Parameters.Add(new ValueLookupParameter<IOperator>("EliteSet Merger", "The operator that merges elements in theelite set."));84 Parameters.Add(new ValueLookupParameter<IOperator>("EliteSetReducer", "The operator that reduces the existing elite set and the new solution to a new elite set.")); 85 85 Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The analyzer that is to be applied.")); 86 86 … … 93 93 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Iterations")); 94 94 95 var variableCreator2 = new VariableCreator();96 variableCreator2.Name = "ActualEliteSetSize = 0";97 variableCreator2.CollectedValues.Add(new ValueParameter<IntValue>("ActualEliteSetSize", new IntValue(0)));98 99 var subScopesCounter1 = new SubScopesCounter();100 subScopesCounter1.Name = "ActualEliteSetSize += |SubScopes|";101 subScopesCounter1.ValueParameter.ActualName = "ActualEliteSetSize";102 103 var comparator1 = new Comparator();104 comparator1.Name = "ActualEliteSetSize >= MinimumEliteSetSize";105 comparator1.Comparison.Value = ComparisonType.GreaterOrEqual;106 comparator1.LeftSideParameter.ActualName = "ActualEliteSetSize";107 comparator1.RightSideParameter.ActualName = EliteSetSizeParameter.ActualName;108 comparator1.ResultParameter.ActualName = "SizeOkay";109 110 var conditionalBranch1 = new ConditionalBranch();111 conditionalBranch1.Name = "Elite set has at least ρ elements";112 conditionalBranch1.ConditionParameter.ActualName = "SizeOkay";113 114 95 var selector1 = new RandomSelector(); 115 96 selector1.NumberOfSelectedSubScopesParameter.Value = new IntValue(1); 116 97 selector1.CopySelected.Value = true; 117 118 var selector2 = new RandomSelector();119 selector2.NumberOfSelectedSubScopesParameter.Value = new IntValue(0);120 98 121 99 var ssp1 = new SubScopesProcessor(); … … 129 107 solutionsCreator.NumberOfSolutions = new IntValue(1); 130 108 131 var subScopesCounter2 = new SubScopesCounter();132 subScopesCounter2.Name = "Count subscopes";133 subScopesCounter2.ValueParameter.ActualName = "SolutionScopes";134 135 var comparator2 = new Comparator();136 comparator2.Name = "SolutionScopes == 2";137 comparator2.Comparison.Value = ComparisonType.Equal;138 comparator2.LeftSideParameter.ActualName = "SolutionScopes";139 comparator2.RightSideParameter.Value = new IntValue(2);140 comparator2.ResultParameter.ActualName = "PerformPR";141 142 var conditionalBranch2 = new ConditionalBranch();143 conditionalBranch2.Name = "Path relinking?";144 conditionalBranch2.ConditionParameter.ActualName = "PerformPR";145 146 109 var ssp2 = new SubScopesProcessor(); 147 110 … … 175 138 176 139 var placeholder5 = new Placeholder(); 177 placeholder5.Name = "(EliteSet Merger)";178 placeholder5.OperatorParameter.ActualName = EliteSet MergerParameter.Name;140 placeholder5.Name = "(EliteSetReplacer)"; 141 placeholder5.OperatorParameter.ActualName = EliteSetReducerParameter.Name; 179 142 180 143 var counter = new IntCounter(); … … 200 163 OperatorGraph.InitialOperator = variableCreator1; 201 164 variableCreator1.Successor = resultsCollector; 202 resultsCollector.Successor = variableCreator2; 203 variableCreator2.Successor = subScopesCounter1; 204 subScopesCounter1.Successor = comparator1; 205 comparator1.Successor = conditionalBranch1; 206 conditionalBranch1.TrueBranch = selector1; 207 conditionalBranch1.FalseBranch = selector2; 208 conditionalBranch1.Successor = ssp1; 165 resultsCollector.Successor = selector1; 166 selector1.Successor = ssp1; 209 167 ssp1.Operators.Add(eo1); 210 168 ssp1.Operators.Add(solutionsCreator); 211 169 ssp1.Successor = placeholder5; 212 170 eo1.Successor = null; 213 solutionsCreator.Successor = subScopesCounter2; 214 subScopesCounter2.Successor = comparator2; 215 comparator2.Successor = conditionalBranch2; 216 conditionalBranch2.TrueBranch = ssp2; 217 conditionalBranch2.FalseBranch = null; 218 conditionalBranch2.Successor = ssp4; 171 solutionsCreator.Successor = ssp2; 219 172 ssp2.Operators.Add(eo2); 220 173 ssp2.Operators.Add(placeholder1); … … 227 180 placeholder2.Successor = placeholder3; 228 181 placeholder3.Successor = subScopesRemover; 229 subScopesRemover.Successor = null; 230 ssp4.Operators.Add(placeholder4); 231 ssp4.Successor = null; 182 subScopesRemover.Successor = placeholder4; 183 placeholder4.Successor = null; 232 184 placeholder5.Successor = counter; 233 185 counter.Successor = analyzer1; … … 235 187 comparator3.Successor = conditionalBranch3; 236 188 conditionalBranch3.TrueBranch = null; 237 conditionalBranch3.FalseBranch = variableCreator2;189 conditionalBranch3.FalseBranch = selector1; 238 190 conditionalBranch3.Successor = null; 239 191 } -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3.csproj
r7413 r7478 89 89 <None Include="Plugin.cs.frame" /> 90 90 <Compile Include="ExtensionMethods.cs" /> 91 <Compile Include="IMerger.cs" />92 91 <Compile Include="IntegerVectorEqualityComparer.cs" /> 92 <Compile Include="IPopulationReducer.cs" /> 93 93 <Compile Include="Plugin.cs" /> 94 94 <Compile Include="Properties\AssemblyInfo.cs" /> -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment-3.3.csproj
r7443 r7478 148 148 <Compile Include="Operators\MultiGQAPManipulator.cs" /> 149 149 <Compile Include="Operators\NMoveShakingOperator.cs" /> 150 <Compile Include="Operators\ QualitySimilarityMerger.cs" />150 <Compile Include="Operators\GQAPQualitySimilarityReducer.cs" /> 151 151 <Compile Include="Operators\RandomSolutionCreator.cs" /> 152 152 <Compile Include="Operators\RelocateEquipmentManipluator.cs" />
Note: See TracChangeset
for help on using the changeset viewer.