Changeset 2852 for trunk/sources/HeuristicLab.Routing.TSP
- Timestamp:
- 02/23/10 06:50:50 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Routing.TSP/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Routing.TSP/3.3/TSP.cs
r2834 r2852 31 31 [Creatable("Problems")] 32 32 [EmptyStorableClass] 33 public sealed class TSP : Problem {33 public sealed class TSP : SingleObjectiveProblem { 34 34 private ValueParameter<DoubleMatrixData> CoordinatesParameter { 35 35 get { return (ValueParameter<DoubleMatrixData>)Parameters["Coordinates"]; } 36 }37 private OperatorParameter SolutionCreatorParameter {38 get { return (OperatorParameter)Parameters["SolutionCreator"]; }39 }40 private OperatorParameter SolutionEvaluatorParameter {41 get { return (OperatorParameter)Parameters["SolutionEvaluator"]; }42 36 } 43 37 … … 46 40 set { CoordinatesParameter.Value = value; } 47 41 } 48 public IOperator SolutionCreator {49 get { return SolutionCreatorParameter.Value; }50 set { SolutionCreatorParameter.Value = value; }51 }52 public IOperator SolutionEvaluator {53 get { return SolutionEvaluatorParameter.Value; }54 set { SolutionEvaluatorParameter.Value = value; }55 }56 42 57 43 public TSP() 58 44 : base() { 59 Parameters.Add(new ValueParameter<BoolData>("Maximization", "Set to false as the TSP is a minimization problem.", new BoolData(false)));45 Maximization = new BoolData(false); 60 46 Parameters.Add(new ValueParameter<DoubleMatrixData>("Coordinates", "The x- and y-Coordinates of the cities.", new DoubleMatrixData(0, 0))); 61 47 Parameters.Add(new ValueParameter<DoubleData>("BestKnownQuality", "The quality of the best known solution of this TSP instance.")); 62 Parameters.Add(new OperatorParameter("SolutionCreator", "The operator which should be used to create new solutions.")); 63 Parameters.Add(new OperatorParameter("SolutionEvaluator", "The operator which should be used to evaluate solutions.")); 48 RandomPermutationCreator creator = new RandomPermutationCreator(); 49 creator.LengthParameter.Value = new IntData(0); 50 SolutionCreator = creator; 51 Evaluator = new TSPRoundedEuclideanPathEvaluator(); 64 52 } 65 53 … … 73 61 SolutionCreator = creator; 74 62 TSPRoundedEuclideanPathEvaluator evaluator = new TSPRoundedEuclideanPathEvaluator(); 75 SolutionEvaluator = evaluator;63 Evaluator = evaluator; 76 64 } 77 65 } -
trunk/sources/HeuristicLab.Routing.TSP/3.3/TSPPathEvaluator.cs
r2834 r2852 22 22 using HeuristicLab.Core; 23 23 using HeuristicLab.Data; 24 using HeuristicLab.Op erators;24 using HeuristicLab.Optimization; 25 25 using HeuristicLab.Parameters; 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 32 32 [Item("TSPPathEvaluator", "A base class for operators which evaluate TSP solutions given in path representation.")] 33 33 [EmptyStorableClass] 34 public abstract class TSPPathEvaluator : Single SuccessorOperator {34 public abstract class TSPPathEvaluator : SingleObjectiveEvaluator { 35 35 public LookupParameter<DoubleMatrixData> CoordinatesParameter { 36 36 get { return (LookupParameter<DoubleMatrixData>)Parameters["Coordinates"]; } … … 39 39 get { return (LookupParameter<Permutation.Permutation>)Parameters["Permutation"]; } 40 40 } 41 public LookupParameter<DoubleData> QualityParameter {42 get { return (LookupParameter<DoubleData>)Parameters["Quality"]; }43 }44 41 45 42 protected TSPPathEvaluator() … … 47 44 Parameters.Add(new LookupParameter<DoubleMatrixData>("Coordinates", "The x- and y-Coordinates of the cities.")); 48 45 Parameters.Add(new LookupParameter<Permutation.Permutation>("Permutation", "The TSP solution given in path representation which should be evaluated.")); 49 Parameters.Add(new LookupParameter<DoubleData>("Quality", "The evaluated quality of the given TSP solution."));50 46 } 51 47
Note: See TracChangeset
for help on using the changeset viewer.