- Timestamp:
- 10/29/20 14:44:19 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.GraphColoring/3.3/GraphColoringProblem.cs
r17745 r17778 43 43 IProblemInstanceConsumer<GCPData>, IProblemInstanceExporter<GCPData> { 44 44 45 [Storable] 46 private IValueParameter<IntMatrix> adjacencyListParameter; 47 public IValueParameter<IntMatrix> AdjacencyListParameter { 48 get { return adjacencyListParameter; } 49 } 50 [Storable] 51 private IValueParameter<EnumValue<FitnessFunction>> fitnessFunctionParameter; 52 public IValueParameter<EnumValue<FitnessFunction>> FitnessFunctionParameter { 53 get { return fitnessFunctionParameter; } 54 } 45 [Storable] public IValueParameter<IntMatrix> AdjacencyListParameter { get; private set; } 46 [Storable] public IValueParameter<EnumValue<FitnessFunction>> FitnessFunctionParameter { get; private set; } 47 [Storable] public IValueParameter<IntValue> BestKnownColorsParameter { get; private set; } 48 [Storable] public IResult<IntValue> BestSolutionColorsResult { get; private set; } 49 [Storable] public IResult<IntValue> BestSolutionConflicts { get; private set; } 50 55 51 public FitnessFunction FitnessFunction { 56 get { return fitnessFunctionParameter.Value.Value; } 57 set { fitnessFunctionParameter.Value.Value = value; } 58 } 59 [Storable] 60 private IValueParameter<IntValue> bestKnownColorsParameter; 61 public IValueParameter<IntValue> BestKnownColorsParameter { 62 get { return bestKnownColorsParameter; } 52 get { return FitnessFunctionParameter.Value.Value; } 53 set { FitnessFunctionParameter.Value.Value = value; } 63 54 } 64 55 … … 67 58 private GraphColoringProblem(GraphColoringProblem original, Cloner cloner) 68 59 : base(original, cloner) { 69 adjacencyListParameter = cloner.Clone(original.adjacencyListParameter);70 fitnessFunctionParameter = cloner.Clone(original.fitnessFunctionParameter);71 bestKnownColorsParameter = cloner.Clone(original.bestKnownColorsParameter);60 AdjacencyListParameter = cloner.Clone(original.AdjacencyListParameter); 61 FitnessFunctionParameter = cloner.Clone(original.FitnessFunctionParameter); 62 BestKnownColorsParameter = cloner.Clone(original.BestKnownColorsParameter); 72 63 RegisterEventHandlers(); 73 64 } 74 65 public GraphColoringProblem() { 75 66 Maximization = false; 76 Parameters.Add(adjacencyListParameter = new ValueParameter<IntMatrix>("Adjacency List", "The adjacency list that describes the (symmetric) edges in the graph with nodes from 0 to N-1.") { ReadOnly = true }); 77 Parameters.Add(fitnessFunctionParameter = new ValueParameter<EnumValue<FitnessFunction>>("Fitness Function", "The function to use for evaluating the quality of a solution.", new EnumValue<FitnessFunction>(FitnessFunction.Penalized))); 78 Parameters.Add(bestKnownColorsParameter = new OptionalValueParameter<IntValue>("BestKnownColors", "The least amount of colors in a valid coloring.") { ReadOnly = true }); 67 Parameters.Add(AdjacencyListParameter = new ValueParameter<IntMatrix>("Adjacency List", "The adjacency list that describes the (symmetric) edges in the graph with nodes from 0 to N-1.") { ReadOnly = true }); 68 Parameters.Add(FitnessFunctionParameter = new ValueParameter<EnumValue<FitnessFunction>>("Fitness Function", "The function to use for evaluating the quality of a solution.", new EnumValue<FitnessFunction>(FitnessFunction.Penalized))); 69 Parameters.Add(BestKnownColorsParameter = new OptionalValueParameter<IntValue>("BestKnownColors", "The least amount of colors in a valid coloring.") { ReadOnly = true }); 70 Results.Add(BestSolutionColorsResult = new Result<IntValue>("Best Solution Colors", "The number of best solution found so far.")); 79 71 80 72 var imat = new IntMatrix(defaultInstance.Length, 2); … … 104 96 105 97 private void RegisterEventHandlers() { 106 fitnessFunctionParameter.ValueChanged += FitnessFunctionParameterOnValueChanged;107 fitnessFunctionParameter.Value.ValueChanged += FitnessFunctionOnValueChanged;98 FitnessFunctionParameter.ValueChanged += FitnessFunctionParameterOnValueChanged; 99 FitnessFunctionParameter.Value.ValueChanged += FitnessFunctionOnValueChanged; 108 100 } 109 101 110 102 private void FitnessFunctionParameterOnValueChanged(object sender, EventArgs eventArgs) { 111 fitnessFunctionParameter.Value.ValueChanged += FitnessFunctionOnValueChanged;103 FitnessFunctionParameter.Value.ValueChanged += FitnessFunctionOnValueChanged; 112 104 FitnessFunctionOnValueChanged(sender, eventArgs); 113 105 } … … 126 118 127 119 public override ISingleObjectiveEvaluationResult Evaluate(LinearLinkage lle, IRandom random, CancellationToken cancellationToken) { 128 var adjList = adjacencyListParameter.Value;120 var adjList = AdjacencyListParameter.Value; 129 121 var llee = lle.ToEndLinks(); // LLE-e encoding uses the highest indexed member as group number 130 122
Note: See TracChangeset
for help on using the changeset viewer.