Changeset 11190
- Timestamp:
- 07/15/14 09:16:57 (10 years ago)
- Location:
- branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/HeuristicLab.Problems.Orienteering-3.3.csproj
r11189 r11190 46 46 </ItemGroup> 47 47 <ItemGroup> 48 <Compile Include="Analyzers\BestOrienteeringSolutionAnalyser.cs" /> 48 49 <Compile Include="DistanceMatrix.cs" /> 49 50 <Compile Include="Interfaces\IOrienteeringEvaluator.cs" /> … … 51 52 <Compile Include="OrienteeringProblem.cs" /> 52 53 <Compile Include="OrienteeringScript.cs" /> 54 <Compile Include="OrienteeringSolution.cs" /> 53 55 <Compile Include="Plugin.cs" /> 54 56 <Compile Include="Properties\AssemblyInfo.cs" /> … … 67 69 <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project> 68 70 <Name>HeuristicLab.Collections-3.3</Name> 71 </ProjectReference> 72 <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj"> 73 <Project>{0e27a536-1c4a-4624-a65e-dc4f4f23e3e1}</Project> 74 <Name>HeuristicLab.Common.Resources-3.3</Name> 69 75 </ProjectReference> 70 76 <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj"> … … 120 126 </ProjectReference> 121 127 </ItemGroup> 128 <ItemGroup /> 122 129 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 123 130 <PropertyGroup> -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/OrienteeringProblem.cs
r11189 r11190 21 21 22 22 using System; 23 using System.Linq; 24 using HeuristicLab.Analysis; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Core; … … 110 112 set { BestKnownSolutionParameter.Value = value; } 111 113 } 114 private BestOrienteeringSolutionAnalyser BestOrienteeringSolutionAnalyser { 115 get { return Operators.OfType<BestOrienteeringSolutionAnalyser>().SingleOrDefault(); } 116 } 117 private SingleObjectivePopulationDiversityAnalyzer SingleObjectivePopulationDiversityAnalyzer { 118 get { return Operators.OfType<SingleObjectivePopulationDiversityAnalyzer>().SingleOrDefault(); } 119 } 112 120 #endregion 113 121 … … 116 124 : base(deserializing) { 117 125 } 118 119 126 private OrienteeringProblem(OrienteeringProblem original, Cloner cloner) 120 127 : base(original, cloner) { 121 128 RegisterEventHandlers(); 122 129 } 123 124 130 public override IDeepCloneable Clone(Cloner cloner) { 125 131 return new OrienteeringProblem(this, cloner); 126 132 } 127 128 129 133 public OrienteeringProblem() 130 134 : base(new OrienteeringEvaluator(), new UniformRandomIntegerVectorCreator()) { // TODO: Greedy route creator for solution creator … … 144 148 SolutionCreator.IntegerVectorParameter.ActualName = "OrienteeringSolution"; 145 149 146 Initialize RandomOrienteeringInstance();150 InitializeInitialOrienteeringInstance(); 147 151 148 152 ParameterizeSolutionCreator(); … … 156 160 protected override void OnSolutionCreatorChanged() { 157 161 base.OnSolutionCreatorChanged(); 158 SolutionCreator.IntegerVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_IntegerVectorParameter_ActualNameChanged);162 SolutionCreator.IntegerVectorParameter.ActualNameChanged += SolutionCreator_IntegerVectorParameter_ActualNameChanged; 159 163 ParameterizeSolutionCreator(); 160 164 ParameterizeEvaluator(); … … 171 175 ParameterizeAnalyzer(); 172 176 ParameterizeOperators(); 177 } 178 private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) { 179 if (Coordinates != null) { 180 Coordinates.ItemChanged += new EventHandler<EventArgs<int, int>>(CoordinatesValue_ItemChanged); 181 Coordinates.Reset += new EventHandler(CoordinatesValue_Reset); 182 } 183 ParameterizeSolutionCreator(); 184 DistanceMatrix = null; 185 } 186 private void CoordinatesValue_ItemChanged(object sender, EventArgs<int, int> e) { 187 DistanceMatrix = null; 188 } 189 private void CoordinatesValue_Reset(object sender, EventArgs e) { 190 ParameterizeSolutionCreator(); 191 DistanceMatrix = null; 192 } 193 private void StartingPointParameter_ValueChanged(object sender, EventArgs e) { 194 ParameterizeEvaluator(); 195 ParameterizeAnalyzer(); 196 } 197 198 private void TerminusPointParameter_ValueChanged(object sender, EventArgs e) { 199 ParameterizeEvaluator(); 200 ParameterizeAnalyzer(); 201 } 202 private void MaximumDistanceParameter_ValueChanged(object sender, EventArgs e) { 203 ParameterizeEvaluator(); 204 ParameterizeAnalyzer(); 205 } 206 private void ScoresParameter_ValueChanged(object sender, EventArgs e) { 207 ParameterizeEvaluator(); 208 ParameterizeAnalyzer(); 209 ParameterizeSolutionCreator(); 210 211 ScoresParameter.Value.Reset += new EventHandler(ScoresValue_Reset); 212 } 213 private void ScoresValue_Reset(object sender, EventArgs e) { 214 ParameterizeSolutionCreator(); 215 } 216 private void FixedPenaltyParameter_ValueChanged(object sender, EventArgs e) { 217 ParameterizeEvaluator(); 218 ParameterizeAnalyzer(); 173 219 } 174 220 #endregion … … 181 227 182 228 private void RegisterEventHandlers() { 183 SolutionCreator.IntegerVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_IntegerVectorParameter_ActualNameChanged); 184 // TODO 185 } 229 SolutionCreator.IntegerVectorParameter.ActualNameChanged += SolutionCreator_IntegerVectorParameter_ActualNameChanged; 230 231 CoordinatesParameter.ValueChanged += CoordinatesParameter_ValueChanged; 232 if (CoordinatesParameter.Value != null) { 233 CoordinatesParameter.Value.ItemChanged += CoordinatesValue_ItemChanged; 234 CoordinatesParameter.Value.Reset += CoordinatesValue_Reset; 235 } 236 237 StartingPointParameter.ValueChanged += StartingPointParameter_ValueChanged; 238 TerminusPointParameter.ValueChanged += TerminusPointParameter_ValueChanged; 239 MaximumDistanceParameter.ValueChanged += MaximumDistanceParameter_ValueChanged; 240 241 ScoresParameter.ValueChanged += ScoresParameter_ValueChanged; 242 ScoresParameter.Value.Reset += ScoresValue_Reset; 243 FixedPenaltyParameter.ValueChanged += FixedPenaltyParameter_ValueChanged; 244 } 245 186 246 private void ParameterizeSolutionCreator() { 187 if (SolutionCreator.LengthParameter.Value == null 188 || SolutionCreator.LengthParameter.Value.Value != Scores.Length) { 189 SolutionCreator.LengthParameter.Value = new IntValue(Scores.Length); 247 if (SolutionCreator is UniformRandomIntegerVectorCreator) { 248 if (SolutionCreator.LengthParameter.Value == null || SolutionCreator.LengthParameter.Value.Value != Scores.Length) { 249 SolutionCreator.LengthParameter.Value = new IntValue(Scores.Length); 250 } 190 251 } 191 252 } … … 193 254 if (Evaluator is OrienteeringEvaluator) { 194 255 var orienteeringEvaluator = (OrienteeringEvaluator)Evaluator; 195 // TODO 256 orienteeringEvaluator.SolutionParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName; 257 orienteeringEvaluator.ScoresParameter.ActualName = ScoresParameter.Name; 196 258 } 197 259 } … … 200 262 } 201 263 private void InitializeOperators() { 202 // TODO 264 // TODO 203 265 } 204 266 private void ParameterizeOperators() { … … 207 269 #endregion 208 270 209 private void InitializeRandomOrienteeringInstance() { 210 // TODO 271 private void InitializeInitialOrienteeringInstance() { 272 Coordinates = new DoubleMatrix(new double[21, 2] { 273 { 4.60, 7.10 }, { 5.70, 11.40 }, { 4.40, 12.30 }, { 2.80, 14.30 }, { 3.20, 10.30 }, 274 { 3.50, 9.80 }, { 4.40, 8.40 }, { 7.80, 11.00 }, { 8.80, 9.80 }, { 7.70, 8.20 }, 275 { 6.30, 7.90 }, { 5.40, 8.20 }, { 5.80, 6.80 }, { 6.70, 5.80 }, { 13.80, 13.10 }, 276 { 14.10, 14.20 }, { 11.20, 13.60 }, { 9.70, 16.40 }, { 9.50, 18.80 }, { 4.70, 16.80 }, 277 { 5.00, 5.60 } 278 }); 279 UseDistanceMatrix.Value = false; 280 281 StartingPoint.Value = 0; 282 TerminusPoint.Value = 20; 283 MaximumDistance.Value = 30; 284 285 Scores = new DoubleArray(new double[21] { 0, 20, 20, 30, 15, 15, 10, 20, 20, 20, 15, 10, 10, 25, 40, 40, 30, 30, 50, 30, 0 }); 211 286 } 212 287
Note: See TracChangeset
for help on using the changeset viewer.