- Timestamp:
- 01/19/12 17:33:28 (13 years ago)
- Location:
- branches/GeneralizedQAP
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/GRASPWithPathRelinkingMainLoop.cs
r7363 r7373 61 61 get { return (IValueLookupParameter<IOperator>)Parameters["PathRelinking"]; } 62 62 } 63 public IValueLookupParameter<IOperator> EliteSet ReplacerParameter {64 get { return (IValueLookupParameter<IOperator>)Parameters["EliteSet Replacer"]; }63 public IValueLookupParameter<IOperator> EliteSetMergerParameter { 64 get { return (IValueLookupParameter<IOperator>)Parameters["EliteSetMerger"]; } 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 Replacer", "The operator that replaces elements in the elite set."));84 Parameters.Add(new ValueLookupParameter<IOperator>("EliteSetMerger", "The operator that merges elements in the elite set.")); 85 85 Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The analyzer that is to be applied.")); 86 86 87 87 var variableCreator1 = new VariableCreator(); 88 variableCreator1.Name = "Iterations = 0"; 88 89 variableCreator1.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0))); 89 90 90 91 var variableCreator2 = new VariableCreator(); 92 variableCreator2.Name = "ActualEliteSetSize = 0"; 91 93 variableCreator2.CollectedValues.Add(new ValueParameter<IntValue>("ActualEliteSetSize", new IntValue(0))); 92 variableCreator2.Name = "ActualEliteSetSize = 0";93 94 94 95 var subScopesCounter1 = new SubScopesCounter(); … … 119 120 120 121 var solutionsCreator = new SolutionsCreator(); 122 solutionsCreator.ParallelParameter.Value = new BoolValue(false); 121 123 solutionsCreator.EvaluatorParameter.ActualName = EvaluatorParameter.Name; 122 124 solutionsCreator.SolutionCreatorParameter.ActualName = SolutionCreatorParameter.Name; … … 149 151 childrenCreator.ParentsPerChild = new IntValue(2); 150 152 153 var ssp3 = new SubScopesProcessor(); 154 151 155 var placeholder2 = new Placeholder(); 152 156 placeholder2.Name = "(PathRelinking)"; … … 156 160 subScopesRemover.RemoveAllSubScopes = true; 157 161 158 var ssp 3= new SubScopesProcessor();162 var ssp4 = new SubScopesProcessor(); 159 163 160 164 var placeholder3 = new Placeholder(); … … 163 167 164 168 var placeholder4 = new Placeholder(); 165 placeholder4.Name = "( Replacer)";166 placeholder4.OperatorParameter.ActualName = EliteSet ReplacerParameter.Name;169 placeholder4.Name = "(EliteSetMerger)"; 170 placeholder4.OperatorParameter.ActualName = EliteSetMergerParameter.Name; 167 171 168 172 var counter = new IntCounter(); … … 203 207 conditionalBranch2.TrueBranch = ssp2; 204 208 conditionalBranch2.FalseBranch = null; 205 conditionalBranch2.Successor = ssp 3;209 conditionalBranch2.Successor = ssp4; 206 210 ssp2.Operators.Add(eo2); 207 211 ssp2.Operators.Add(placeholder1); 208 ssp2.Successor = null;212 ssp2.Successor = childrenCreator; 209 213 eo2.Successor = null; 210 placeholder1.Successor = childrenCreator; 211 childrenCreator.Successor = placeholder2; 214 placeholder1.Successor = null; 215 childrenCreator.Successor = ssp3; 216 ssp3.Operators.Add(placeholder2); 217 ssp3.Successor = null; 212 218 placeholder2.Successor = subScopesRemover; 213 219 subScopesRemover.Successor = null; 214 ssp 3.Operators.Add(placeholder3);215 ssp 3.Successor = null;220 ssp4.Operators.Add(placeholder3); 221 ssp4.Successor = null; 216 222 placeholder4.Successor = counter; 217 223 counter.Successor = analyzer1; -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GeneralizedQuadraticAssignmentProblem.cs
r7319 r7373 36 36 [Creatable("Problems")] 37 37 [StorableClass] 38 public sealed class GeneralizedQuadraticAssignmentProblem : SingleObjectiveHeuristicOptimizationProblem<IGQAPEvaluator, I IntegerVectorCreator>, IStorableContent {38 public sealed class GeneralizedQuadraticAssignmentProblem : SingleObjectiveHeuristicOptimizationProblem<IGQAPEvaluator, IGQAPSolutionCreator>, IStorableContent { 39 39 public override Image ItemImage { 40 40 get { return HeuristicLab.Common.Resources.VSImageLibrary.Type; } … … 109 109 } 110 110 public GeneralizedQuadraticAssignmentProblem() 111 : base(new GQAPEvaluator(), new UniformRandomIntegerVectorCreator()) {111 : base(new GQAPEvaluator(), new RandomSolutionCreator()) { 112 112 Parameters.Add(new ValueParameter<DoubleMatrix>("Weights", "The weights matrix describes the flows between the equipments.", new DoubleMatrix())); 113 113 Parameters.Add(new ValueParameter<DoubleMatrix>("Distances", "The distances matrix describes the distances between the locations at which the equipment can be installed.", new DoubleMatrix())); … … 146 146 Capacities[0] = 4; Capacities[1] = 1; Capacities[2] = 4; 147 147 148 SolutionCreator. IntegerVectorParameter.ActualName = "Assignment";148 SolutionCreator.AssignmentParameter.ActualName = "Assignment"; 149 149 Parameterize(); 150 150 … … 184 184 [StorableHook(HookType.AfterDeserialization)] 185 185 private void AfterDeserializationHook() { 186 // BackwardsCompatibility3.3187 #region Backwards compatible code, remove with 3.4188 if (!Parameters.ContainsKey("EquipmentNames"))189 Parameters.Add(new OptionalValueParameter<StringArray>("EquipmentNames", "Optional: A list of names that describes the equipments.", null, false));190 if (!Parameters.ContainsKey("LocationNames"))191 Parameters.Add(new OptionalValueParameter<StringArray>("LocationNames", "Optional: A list of names that describes the locations.", null, false));192 #endregion193 186 AttachEventHandlers(); 194 187 } … … 196 189 private void AttachEventHandlers() { 197 190 Evaluator.QualityParameter.ActualNameChanged += new System.EventHandler(Evaluator_QualityParameter_ActualNameChanged); 198 SolutionCreator. IntegerVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_IntegerVectorParameter_ActualNameChanged);191 SolutionCreator.AssignmentParameter.ActualNameChanged += new EventHandler(SolutionCreator_IntegerVectorParameter_ActualNameChanged); 199 192 } 200 193 … … 214 207 Evaluator.DemandsParameter.ActualName = DemandsParameter.Name; 215 208 Evaluator.CapacitiesParameter.ActualName = CapacitiesParameter.Name; 216 Evaluator.AssignmentParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName; 217 218 SolutionCreator.LengthParameter.Value = new IntValue(Demands.Length); 219 SolutionCreator.MinimumParameter.Value = new IntValue(0); 220 SolutionCreator.MaximumParameter.Value = new IntValue(Capacities.Length); 209 Evaluator.AssignmentParameter.ActualName = SolutionCreator.AssignmentParameter.ActualName; 210 211 SolutionCreator.DemandsParameter.ActualName = DemandsParameter.Name; 212 SolutionCreator.CapacitiesParameter.ActualName = CapacitiesParameter.Name; 221 213 222 214 foreach (var op in Operators.OfType<IIntegerVectorCrossover>()) { 223 op.ParentsParameter.ActualName = SolutionCreator. IntegerVectorParameter.ActualName;224 op.ChildParameter.ActualName = SolutionCreator. IntegerVectorParameter.ActualName;215 op.ParentsParameter.ActualName = SolutionCreator.AssignmentParameter.ActualName; 216 op.ChildParameter.ActualName = SolutionCreator.AssignmentParameter.ActualName; 225 217 } 226 218 foreach (var op in Operators.OfType<IIntegerVectorManipulator>()) { 227 op.IntegerVectorParameter.ActualName = SolutionCreator. IntegerVectorParameter.ActualName;219 op.IntegerVectorParameter.ActualName = SolutionCreator.AssignmentParameter.ActualName; 228 220 } 229 221 foreach (var op in Operators.OfType<IGQAPCrossover>()) { 230 op.ParentsParameter.ActualName = SolutionCreator. IntegerVectorParameter.ActualName;231 op.ChildParameter.ActualName = SolutionCreator. IntegerVectorParameter.ActualName;222 op.ParentsParameter.ActualName = SolutionCreator.AssignmentParameter.ActualName; 223 op.ChildParameter.ActualName = SolutionCreator.AssignmentParameter.ActualName; 232 224 } 233 225 foreach (var op in Operators.OfType<IGQAPManipulator>()) { 234 op.IntegerVectorParameter.ActualName = SolutionCreator. IntegerVectorParameter.ActualName;226 op.IntegerVectorParameter.ActualName = SolutionCreator.AssignmentParameter.ActualName; 235 227 } 236 228 foreach (var op in Operators.OfType<ILocationAwareGQAPOperator>()) { 237 229 op.CapacitiesParameter.ActualName = CapacitiesParameter.Name; 238 230 } 239 foreach (var op in Operators.OfType<IEquipmentAwareGQAP Manipulator>()) {231 foreach (var op in Operators.OfType<IEquipmentAwareGQAPOperator>()) { 240 232 op.DemandsParameter.ActualName = DemandsParameter.Name; 241 233 } … … 245 237 BestSolutionAnalyzer.DistancesParameter.ActualName = DistancesParameter.Name; 246 238 BestSolutionAnalyzer.WeightsParameter.ActualName = WeightsParameter.Name; 247 BestSolutionAnalyzer.AssignmentParameter.ActualName = SolutionCreator. IntegerVectorParameter.ActualName;239 BestSolutionAnalyzer.AssignmentParameter.ActualName = SolutionCreator.AssignmentParameter.ActualName; 248 240 BestSolutionAnalyzer.ResultsParameter.ActualName = "Results"; 249 241 BestSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name; -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Interfaces/IEquipmentAwareGQAPOperator.cs
r7319 r7373 24 24 25 25 namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment { 26 public interface IEquipmentAwareGQAP Manipulator : IGQAPManipulator {26 public interface IEquipmentAwareGQAPOperator : IGQAPOperator { 27 27 ILookupParameter<DoubleArray> DemandsParameter { get; } 28 28 } -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Operators/DemandEquivalentSwapEquipmentManipluator.cs
r7319 r7373 34 34 [Item("DemandEquivalentSwapEquipmentManipluator", "Swaps equipment X from location A with as much equipments from location B that the demand of X is less than or equal to the demand of the swapped equipments in B.")] 35 35 [StorableClass] 36 public class DemandEquivalentSwapEquipmentManipluator : GQAPManipulator, ILocationAwareGQAPOperator, IEquipmentAwareGQAP Manipulator {37 36 public class DemandEquivalentSwapEquipmentManipluator : GQAPManipulator, ILocationAwareGQAPOperator, IEquipmentAwareGQAPOperator { 37 38 38 public ILookupParameter<DoubleArray> CapacitiesParameter { 39 39 get { return (ILookupParameter<DoubleArray>)Parameters["Capacities"]; }
Note: See TracChangeset
for help on using the changeset viewer.