Index: /trunk/sources/HeuristicLab 3.3.sln
===================================================================
--- /trunk/sources/HeuristicLab 3.3.sln (revision 12721)
+++ /trunk/sources/HeuristicLab 3.3.sln (revision 12722)
@@ -127,4 +127,6 @@
{0C2917C8-7AA8-4E18-800A-C4D064F992ED} = {0C2917C8-7AA8-4E18-800A-C4D064F992ED}
{79271BC8-4446-40E2-BB89-9BE4E17174FE} = {79271BC8-4446-40E2-BB89-9BE4E17174FE}
+ {BBF2CCC8-4D87-4297-8E18-8241FF93F966} = {BBF2CCC8-4D87-4297-8E18-8241FF93F966}
+ {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372} = {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372}
{7A2531CE-3F7C-4F13-BCCA-ED6DC27A7086} = {7A2531CE-3F7C-4F13-BCCA-ED6DC27A7086}
{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B} = {102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}
@@ -134,4 +136,5 @@
{1F2718DA-BF13-40EE-A7FD-EEDB4912E64E} = {1F2718DA-BF13-40EE-A7FD-EEDB4912E64E}
{DDFB14DD-2A85-493C-A52D-E69729BBAEB0} = {DDFB14DD-2A85-493C-A52D-E69729BBAEB0}
+ {B37BF2DD-752C-456A-9DEF-FF5B41FC3C77} = {B37BF2DD-752C-456A-9DEF-FF5B41FC3C77}
{05BAE4E1-A9FA-4644-AA77-42558720159E} = {05BAE4E1-A9FA-4644-AA77-42558720159E}
{88B9B0E3-344E-4196-82A3-0F9732506FE8} = {88B9B0E3-344E-4196-82A3-0F9732506FE8}
@@ -425,4 +428,10 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Encodings.LinearLinkageEncoding-3.3", "HeuristicLab.Encodings.LinearLinkageEncoding\3.3\HeuristicLab.Encodings.LinearLinkageEncoding-3.3.csproj", "{BE698769-975A-429E-828C-72BB2B6182C8}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.Orienteering-3.3", "HeuristicLab.Problems.Orienteering\3.3\HeuristicLab.Problems.Orienteering-3.3.csproj", "{D1EFA4CC-909F-41D5-9C1F-C3AF1957A372}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.Orienteering.Views-3.3", "HeuristicLab.Problems.Orienteering.Views\3.3\HeuristicLab.Problems.Orienteering.Views-3.3.csproj", "{BBF2CCC8-4D87-4297-8E18-8241FF93F966}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.Instances.Orienteering-3.3", "HeuristicLab.Problems.Instances.Orienteering\3.3\HeuristicLab.Problems.Instances.Orienteering-3.3.csproj", "{B37BF2DD-752C-456A-9DEF-FF5B41FC3C77}"
EndProject
Global
@@ -2068,4 +2077,40 @@
{BE698769-975A-429E-828C-72BB2B6182C8}.Release|x86.ActiveCfg = Release|x86
{BE698769-975A-429E-828C-72BB2B6182C8}.Release|x86.Build.0 = Release|x86
+ {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372}.Debug|x64.ActiveCfg = Debug|x64
+ {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372}.Debug|x64.Build.0 = Debug|x64
+ {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372}.Debug|x86.ActiveCfg = Debug|x86
+ {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372}.Debug|x86.Build.0 = Debug|x86
+ {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372}.Release|x64.ActiveCfg = Release|x64
+ {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372}.Release|x64.Build.0 = Release|x64
+ {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372}.Release|x86.ActiveCfg = Release|x86
+ {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372}.Release|x86.Build.0 = Release|x86
+ {BBF2CCC8-4D87-4297-8E18-8241FF93F966}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BBF2CCC8-4D87-4297-8E18-8241FF93F966}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BBF2CCC8-4D87-4297-8E18-8241FF93F966}.Debug|x64.ActiveCfg = Debug|x64
+ {BBF2CCC8-4D87-4297-8E18-8241FF93F966}.Debug|x64.Build.0 = Debug|x64
+ {BBF2CCC8-4D87-4297-8E18-8241FF93F966}.Debug|x86.ActiveCfg = Debug|x86
+ {BBF2CCC8-4D87-4297-8E18-8241FF93F966}.Debug|x86.Build.0 = Debug|x86
+ {BBF2CCC8-4D87-4297-8E18-8241FF93F966}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BBF2CCC8-4D87-4297-8E18-8241FF93F966}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BBF2CCC8-4D87-4297-8E18-8241FF93F966}.Release|x64.ActiveCfg = Release|x64
+ {BBF2CCC8-4D87-4297-8E18-8241FF93F966}.Release|x64.Build.0 = Release|x64
+ {BBF2CCC8-4D87-4297-8E18-8241FF93F966}.Release|x86.ActiveCfg = Release|x86
+ {BBF2CCC8-4D87-4297-8E18-8241FF93F966}.Release|x86.Build.0 = Release|x86
+ {B37BF2DD-752C-456A-9DEF-FF5B41FC3C77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B37BF2DD-752C-456A-9DEF-FF5B41FC3C77}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B37BF2DD-752C-456A-9DEF-FF5B41FC3C77}.Debug|x64.ActiveCfg = Debug|x64
+ {B37BF2DD-752C-456A-9DEF-FF5B41FC3C77}.Debug|x64.Build.0 = Debug|x64
+ {B37BF2DD-752C-456A-9DEF-FF5B41FC3C77}.Debug|x86.ActiveCfg = Debug|x86
+ {B37BF2DD-752C-456A-9DEF-FF5B41FC3C77}.Debug|x86.Build.0 = Debug|x86
+ {B37BF2DD-752C-456A-9DEF-FF5B41FC3C77}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B37BF2DD-752C-456A-9DEF-FF5B41FC3C77}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B37BF2DD-752C-456A-9DEF-FF5B41FC3C77}.Release|x64.ActiveCfg = Release|x64
+ {B37BF2DD-752C-456A-9DEF-FF5B41FC3C77}.Release|x64.Build.0 = Release|x64
+ {B37BF2DD-752C-456A-9DEF-FF5B41FC3C77}.Release|x86.ActiveCfg = Release|x86
+ {B37BF2DD-752C-456A-9DEF-FF5B41FC3C77}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
Index: /trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj (revision 12721)
+++ /trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj (revision 12722)
@@ -145,4 +145,5 @@
+
Index: /trunk/sources/HeuristicLab.Optimizer/3.3/StartPage.cs
===================================================================
--- /trunk/sources/HeuristicLab.Optimizer/3.3/StartPage.cs (revision 12721)
+++ /trunk/sources/HeuristicLab.Optimizer/3.3/StartPage.cs (revision 12722)
@@ -139,5 +139,5 @@
var standardProblems = new List { "ES_Griewank", "GA_TSP", "GA_VRP", "GE_ArtificialAnt",
"IslandGA_TSP", "LS_Knapsack", "PSO_Schwefel", "RAPGA_JSSP",
- "SA_Rastrigin", "SGP_SantaFe","GP_Multiplexer", "SS_VRP", "TS_TSP", "TS_VRP", "VNS_TSP"
+ "SA_Rastrigin", "SGP_SantaFe","GP_Multiplexer", "SS_VRP", "TS_TSP", "TS_VRP", "VNS_OP" ,"VNS_TSP"
};
groupLookup[standardProblemsGroup] = standardProblems;
Index: /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/HeuristicLab.Problems.Instances.Orienteering-3.3.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/HeuristicLab.Problems.Instances.Orienteering-3.3.csproj (revision 12722)
+++ /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/HeuristicLab.Problems.Instances.Orienteering-3.3.csproj (revision 12722)
@@ -0,0 +1,126 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {B37BF2DD-752C-456A-9DEF-FF5B41FC3C77}
+ Library
+ Properties
+ HeuristicLab.Problems.Instances.Orienteering
+ HeuristicLab.Problems.Instances.Orienteering-3.3
+ v4.5
+ 512
+
+
+
+ true
+ full
+ false
+ ..\..\bin\
+ DEBUG;TRACE
+ prompt
+ 4
+ false
+
+
+ pdbonly
+ true
+ ..\..\bin\
+ TRACE
+ prompt
+ 4
+ false
+
+
+ true
+
+
+ HeuristicLab.snk
+
+
+ true
+ ..\..\bin\
+ DEBUG;TRACE
+ full
+ x64
+ prompt
+ MinimumRecommendedRules.ruleset
+ false
+
+
+ ..\..\bin\
+ TRACE
+ true
+ pdbonly
+ x64
+ prompt
+ MinimumRecommendedRules.ruleset
+ false
+
+
+ true
+ ..\..\bin\
+ DEBUG;TRACE
+ full
+ x86
+ prompt
+ MinimumRecommendedRules.ruleset
+ false
+
+
+ ..\..\bin\
+ TRACE
+ true
+ pdbonly
+ x86
+ prompt
+ MinimumRecommendedRules.ruleset
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}
+ HeuristicLab.Common-3.3
+
+
+ {94186A6A-5176-4402-AE83-886557B53CCA}
+ HeuristicLab.PluginInfrastructure-3.3
+
+
+ {3540E29E-4793-49E7-8EE2-FEA7F61C3994}
+ HeuristicLab.Problems.Instances-3.3
+
+
+
+
+ set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+
+call PreBuildEvent.cmd
+
+
+
Index: /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/OPDataDescriptor.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/OPDataDescriptor.cs (revision 12722)
+++ /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/OPDataDescriptor.cs (revision 12722)
@@ -0,0 +1,14 @@
+namespace HeuristicLab.Problems.Instances.Orienteering {
+ internal class OPDataDescriptor : IDataDescriptor {
+ public string Name { get; internal set; }
+ public string Description { get; internal set; }
+
+ internal string InstanceIdentifier { get; set; }
+
+ internal OPDataDescriptor(string name, string description, string instanceIdentifier) {
+ Name = name;
+ Description = description;
+ InstanceIdentifier = instanceIdentifier;
+ }
+ }
+}
Index: /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/Plugin.cs.frame
===================================================================
--- /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/Plugin.cs.frame (revision 12722)
+++ /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/Plugin.cs.frame (revision 12722)
@@ -0,0 +1,29 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Problems.Instances.Orienteering {
+ [Plugin("HeuristicLab.Problems.Instances.Orienteering", "3.3.11.$WCREV$")]
+ [PluginFile("HeuristicLab.Problems.Instances.Orienteering-3.3.dll", PluginFileType.Assembly)]
+ [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
+ public class HeuristicLabProblemsInstancesOrienteeringPlugin : PluginBase { }
+}
Index: /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/Properties/AssemblyInfo.cs.frame
===================================================================
--- /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/Properties/AssemblyInfo.cs.frame (revision 12722)
+++ /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/Properties/AssemblyInfo.cs.frame (revision 12722)
@@ -0,0 +1,56 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.Problems.Instances.Orienteering")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("HEAL")]
+[assembly: AssemblyProduct("HeuristicLab")]
+[assembly: AssemblyCopyright("(c) 2002-2015 HEAL")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("6b78313c-878a-4ca5-bfcf-dfccf8cb8926")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("3.3.0.0")]
+[assembly: AssemblyFileVersion("3.3.11.$WCREV$")]
Index: /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/SchildeInstanceProvider.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/SchildeInstanceProvider.cs (revision 12722)
+++ /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/SchildeInstanceProvider.cs (revision 12722)
@@ -0,0 +1,116 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.IO.Compression;
+using System.Linq;
+using System.Reflection;
+using System.Text.RegularExpressions;
+using HeuristicLab.Problems.Instances.Types;
+
+namespace HeuristicLab.Problems.Instances.Orienteering {
+ public class SchildeInstanceProvider : ProblemInstanceProvider {
+ public override string Name {
+ get { return "Schilde (OP)"; }
+ }
+ public override string Description {
+ get { return "Modified Tsiligirdes (1984) and Chao (1996) instances by Schilde."; }
+ }
+ public override string ReferencePublication {
+ get {
+ return @"Michael Schilde, Karl F. Doerner, Richard F. Hartl, Guenter Kiechle. 2009.
+Metaheuristics for the bi-objective orienteering problem.
+Swarm Intelligence, Volume 3, Issue 3, pp 179-201.";
+ }
+ }
+ public override Uri WebLink {
+ get { return new Uri("http://prolog.univie.ac.at/research/OP/"); }
+ }
+
+ private const string FileName = "Schilde";
+
+ public override IEnumerable GetDataDescriptors() {
+ var instanceArchiveName = GetResourceName(FileName + @"\.zip");
+ if (String.IsNullOrEmpty(instanceArchiveName)) yield break;
+
+ using (var instanceStream = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {
+ foreach (var entry in instanceStream.Entries.Select(x => x.Name).OrderBy(x => x)) {
+ yield return new OPDataDescriptor(Path.GetFileNameWithoutExtension(entry), GetInstanceDescription(), entry);
+ }
+ }
+ }
+ public override OPData LoadData(IDataDescriptor id) {
+ var descriptor = (OPDataDescriptor)id;
+ var instanceArchiveName = GetResourceName(FileName + @"\.zip");
+ var parser = new SchildeParser();
+ using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {
+ var entry = instancesZipFile.GetEntry(descriptor.InstanceIdentifier);
+ using (var stream = entry.Open()) {
+ parser.Parse(stream);
+ var instance = LoadInstance(parser);
+
+ instance.Name = id.Name;
+ instance.Description = id.Description;
+
+ return instance;
+ }
+ }
+ }
+
+ public override bool CanImportData {
+ get { return true; }
+ }
+ public override OPData ImportData(string path) {
+ var parser = new SchildeParser();
+ parser.Parse(path);
+ var instance = LoadInstance(parser);
+
+ instance.Name = Path.GetFileName(path);
+ instance.Description = "Loaded from file \"" + path + "\" on " + DateTime.Now.ToString();
+
+ return instance;
+ }
+
+ private OPData LoadInstance(SchildeParser parser) {
+ return new OPData {
+ Dimension = parser.Coordinates.GetLength(0),
+ Coordinates = parser.Coordinates,
+ Distances = parser.Distances,
+ DistanceMeasure = parser.Distances != null ? DistanceMeasure.Direct : DistanceMeasure.Euclidean,
+ MaximumDistance = parser.UpperBoundConstraint,
+ StartingPoint = parser.StartingPoint,
+ TerminalPoint = parser.TerminalPoint,
+ Scores = Enumerable.Range(0, parser.Scores.GetLength(0)).Select(i => parser.Scores[i, 0]).ToArray()
+ };
+ }
+
+ protected virtual string GetResourceName(string fileName) {
+ return Assembly.GetExecutingAssembly().GetManifestResourceNames()
+ .SingleOrDefault(x => Regex.Match(x, @".*\.Data\." + fileName).Success);
+ }
+
+ protected virtual string GetInstanceDescription() {
+ return "Embedded instance of plugin version " + Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true).Cast().First().Version + ".";
+ }
+ }
+}
Index: /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/SchildeParser.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/SchildeParser.cs (revision 12722)
+++ /trunk/sources/HeuristicLab.Problems.Instances.Orienteering/3.3/SchildeParser.cs (revision 12722)
@@ -0,0 +1,283 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+
+namespace HeuristicLab.Problems.Instances.Orienteering {
+ public class SchildeParser {
+ private static readonly IFormatProvider FormatProvider = new CultureInfo("en-US");
+
+ private int currentPoint;
+ private int currentDistance;
+
+ public double[,] Coordinates { get; private set; }
+ public double[,] Distances { get; private set; }
+ public double[,] Scores { get; private set; }
+ public int StartingPoint { get; private set; }
+ public int TerminalPoint { get; private set; }
+ public double UpperBoundConstraint { get; private set; }
+ public double LowerConstraint { get; private set; }
+
+ public void Reset() {
+ currentPoint = 0;
+ currentDistance = 0;
+
+ Coordinates = null;
+ Distances = null;
+ Scores = null;
+ StartingPoint = 0;
+ TerminalPoint = 0;
+ UpperBoundConstraint = 0.0;
+ LowerConstraint = 0.0;
+
+ }
+
+ public void Parse(string file) {
+ using (var stream = new FileStream(file, FileMode.Open, FileAccess.Read)) {
+ Parse(stream);
+ }
+ }
+ public void Parse(Stream stream) {
+ int lineNumber = 0;
+
+ using (var reader = new StreamReader(stream)) {
+ // Read the lines from the file
+ while (!reader.EndOfStream) {
+ string lineBuffer = reader.ReadLine();
+
+ // Remove all whitespace
+ lineBuffer = new string(lineBuffer.ToCharArray().Where(c => !char.IsWhiteSpace(c)).ToArray());
+
+ // If the line contains data, continue
+ if (lineBuffer.Length > 1) {
+ // If the line contains not only a comment, process it
+ int commentPosition = lineBuffer.IndexOf("//");
+ if (commentPosition != 0) {
+ // Count the lines that include data
+ lineNumber++;
+
+ // Remove a comment if there is one
+ if (commentPosition > 0)
+ lineBuffer = lineBuffer.Remove(commentPosition);
+
+ // Convert the line to lowercase characters
+ lineBuffer = lineBuffer.ToLower();
+
+ // Skip version info in file
+ if (lineNumber > 1) {
+ // Extract the needed information
+ ExtractData(lineBuffer);
+ }
+ }
+ }
+ }
+ }
+ }
+ private void ExtractData(string inputString) {
+ string temp;
+ int pointCount;
+
+ switch (inputString[0]) {
+ case 'p': // Point description
+ if (inputString.Length < 8)
+ throw new IOException("Invalid Definition P");
+
+ // Remove the 'p,'
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+ // Get the position_x
+ string positionX = inputString.Substring(0, inputString.IndexOf(','));
+ // Remove the position_x
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+ // Get the postion_y
+ string positionY = inputString.Substring(0, inputString.IndexOf(','));
+ // Remove the position_y to get the scores
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+
+ Coordinates[currentPoint, 0] = double.Parse(positionX, FormatProvider);
+ Coordinates[currentPoint, 1] = double.Parse(positionY, FormatProvider);
+
+ // Extract all score values for this point
+ int scoreIndex = 0;
+ while (true) {
+ string score;
+ if (inputString.IndexOf(',') != -1) {
+ score = inputString.Substring(0, inputString.IndexOf(','));
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+ Scores[currentPoint, scoreIndex++] = int.Parse(score, FormatProvider);
+ } else {
+ score = inputString;
+ Scores[currentPoint, scoreIndex++] = int.Parse(score, FormatProvider);
+ break;
+ }
+ }
+ currentPoint++;
+ break;
+
+ case 'd': // Distance information
+ if (inputString.Length < 11)
+ throw new IOException("Invalid Definition D");
+
+ //var tempDistances = new List();
+
+ // Remove the 'd,'
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+
+ // Extract all distances for this point
+ int distanceIndex = 0;
+ while (true) {
+ string distance;
+ if (inputString.IndexOf(',') != -1) {
+ distance = inputString.Substring(0, inputString.IndexOf(','));
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+ Distances[currentDistance, distanceIndex++] = double.Parse(distance, FormatProvider);
+ } else {
+ distance = inputString;
+ Distances[currentDistance, distanceIndex++] = double.Parse(distance, FormatProvider);
+ break;
+ }
+ }
+ break;
+
+ case 'n': // Number of points
+ if (inputString.Length < 3)
+ throw new IOException("Invalid Definition N");
+
+ // Remove the 'n,'
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+ // Extract the number of points
+
+ pointCount = int.Parse(inputString, FormatProvider);
+ Coordinates = new double[pointCount, 2];
+ break;
+
+ case 'm': // 1 if Distance-Matrix is given
+ if (inputString.Length < 3)
+ throw new IOException("Invalid Definition M");
+
+ // Remove the 'm,'
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+ // Extract the number of points
+ bool matrixGiven = true;
+
+ pointCount = Coordinates.GetLength(1);
+ Distances = new double[pointCount, pointCount];
+ break;
+
+ case 'c': // Number of constraints
+ if (inputString.Length < 3)
+ throw new IOException("Invalid Definition C");
+
+ // Remove the 'c,'
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+ break;
+
+ case 's': // Number of scores per point
+ if (inputString.Length < 3)
+ throw new IOException("Invalid Definition S");
+
+ // Remove the 's,'
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+ int scoreCount = int.Parse(inputString, FormatProvider);
+
+ pointCount = Coordinates.GetLength(0);
+ Scores = new double[pointCount, scoreCount];
+
+ break;
+
+ case 'b': // Index of the starting point
+ if (inputString.Length < 3)
+ throw new IOException("Invalid Definition B");
+
+ // Remove the 'b,'
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+ StartingPoint = int.Parse(inputString, FormatProvider);
+ break;
+
+ case 'e': // Index of the terminus point
+ if (inputString.Length < 3)
+ throw new IOException("Invalid Definition E");
+
+ // Remove the 'e,'
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+ TerminalPoint = int.Parse(inputString, FormatProvider);
+ break;
+
+ case 'u': // Upper bound constraint
+ if (inputString.Length < 5)
+ throw new IOException("Invalid Definition U");
+
+ // Remove the 'u,'
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+ // Get the target
+ temp = inputString.Substring(0, inputString.IndexOf(','));
+ // Remove the target to get the target value
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+
+ UpperBoundConstraint = double.Parse(inputString, FormatProvider);
+ break;
+
+ case 'l': // Lower bound constraint
+ if (inputString.Length < 5)
+ throw new IOException("Invalid Definition L");
+
+ // Remove the 'l,'
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+ // Get the target
+ temp = inputString.Substring(0, inputString.IndexOf(','));
+ // Remove the target to get the target value
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+
+ LowerConstraint = double.Parse(inputString, FormatProvider);
+ break;
+
+ case 'x': // Maximization constraint
+ if (inputString.Length < 5)
+ throw new IOException("Invalid Definition X");
+
+ // Remove the 'x,'
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+ // Get the target
+ temp = inputString.Substring(0, inputString.IndexOf(','));
+ // Remove the target to get the target value
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+
+ break;
+
+ case 'i': // Minimization constraint
+ if (inputString.Length < 5)
+ throw new IOException("Invalid Definition I");
+
+ // Remove the 'i,'
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+ // Get the target
+ temp = inputString.Substring(0, inputString.IndexOf(','));
+ // Remove the target to get the target value
+ inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
+
+ break;
+ }
+ }
+ }
+}
Index: /trunk/sources/HeuristicLab.Problems.Instances/3.3/HeuristicLab.Problems.Instances-3.3.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Problems.Instances/3.3/HeuristicLab.Problems.Instances-3.3.csproj (revision 12721)
+++ /trunk/sources/HeuristicLab.Problems.Instances/3.3/HeuristicLab.Problems.Instances-3.3.csproj (revision 12722)
@@ -126,4 +126,5 @@
+
Index: /trunk/sources/HeuristicLab.Problems.Instances/3.3/Types/OPData.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.Instances/3.3/Types/OPData.cs (revision 12722)
+++ /trunk/sources/HeuristicLab.Problems.Instances/3.3/Types/OPData.cs (revision 12722)
@@ -0,0 +1,49 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+
+namespace HeuristicLab.Problems.Instances.Types {
+ ///
+ /// Describes instances of the Orienteering Problem (OP).
+ ///
+ public class OPData : TSPData {
+ ///
+ /// The maximum distance constraint for a Orienteering solution.
+ ///
+ public double MaximumDistance { get; set; }
+ ///
+ /// The scores of the points.
+ ///
+ public double[] Scores { get; set; }
+ ///
+ /// The penalty for each visited vertex.
+ ///
+ public double PointVisitingCosts { get; set; }
+ ///
+ /// Index of the starting point
+ ///
+ public int StartingPoint { get; set; }
+ ///
+ /// Index of the ending point.
+ ///
+ public int TerminalPoint { get; set; }
+ }
+}
Index: /trunk/sources/HeuristicLab.Problems.Orienteering.Views/3.3/HeuristicLab.Problems.Orienteering.Views-3.3.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Problems.Orienteering.Views/3.3/HeuristicLab.Problems.Orienteering.Views-3.3.csproj (revision 12722)
+++ /trunk/sources/HeuristicLab.Problems.Orienteering.Views/3.3/HeuristicLab.Problems.Orienteering.Views-3.3.csproj (revision 12722)
@@ -0,0 +1,197 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {BBF2CCC8-4D87-4297-8E18-8241FF93F966}
+ Library
+ Properties
+ HeuristicLab.Problems.Orienteering.Views
+ HeuristicLab.Problems.Orienteering.Views-3.3
+ v4.5
+ 512
+
+
+
+ true
+ full
+ false
+ ..\..\bin\
+ DEBUG;TRACE
+ prompt
+ 4
+ false
+
+
+ pdbonly
+ true
+ ..\..\bin\
+ TRACE
+ prompt
+ 4
+ false
+
+
+ true
+
+
+ HeuristicLab.snk
+
+
+ true
+ ..\..\bin\
+ DEBUG;TRACE
+ full
+ x64
+ prompt
+ MinimumRecommendedRules.ruleset
+ false
+
+
+ ..\..\bin\
+ TRACE
+ true
+ pdbonly
+ x64
+ prompt
+ MinimumRecommendedRules.ruleset
+ false
+
+
+ true
+ ..\..\bin\
+ DEBUG;TRACE
+ full
+ x86
+ prompt
+ MinimumRecommendedRules.ruleset
+ false
+
+
+ ..\..\bin\
+ TRACE
+ true
+ pdbonly
+ x86
+ prompt
+ MinimumRecommendedRules.ruleset
+ false
+
+
+
+ False
+ ..\..\bin\HeuristicLab.Data.Views-3.3.dll
+
+
+ False
+ ..\..\bin\HeuristicLab.Encodings.PermutationEncoding-3.3.dll
+
+
+ False
+ ..\..\bin\HeuristicLab.Problems.LinearAssignment-3.3.dll
+
+
+
+
+
+
+
+
+
+
+ UserControl
+
+
+ OrienteeringProblemView.cs
+
+
+ UserControl
+
+
+ OrienteeringSolutionView.cs
+
+
+
+
+
+
+
+
+
+
+
+ {A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}
+ HeuristicLab.Common-3.3
+
+
+ {E226881D-315F-423D-B419-A766FE0D8685}
+ HeuristicLab.Core.Views-3.3
+
+
+ {C36BD924-A541-4A00-AFA8-41701378DDC5}
+ HeuristicLab.Core-3.3
+
+
+ {BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}
+ HeuristicLab.Data-3.3
+
+
+ {DDFB14DD-2A85-493C-A52D-E69729BBAEB0}
+ HeuristicLab.Encodings.IntegerVectorEncoding-3.3
+
+
+ {AB687BBE-1BFE-476B-906D-44237135431D}
+ HeuristicLab.MainForm.WindowsForms-3.3
+
+
+ {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}
+ HeuristicLab.MainForm-3.3
+
+
+ {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}
+ HeuristicLab.Optimization.Views-3.3
+
+
+ {14AB8D24-25BC-400C-A846-4627AA945192}
+ HeuristicLab.Optimization-3.3
+
+
+ {56F9106A-079F-4C61-92F6-86A84C2D84B7}
+ HeuristicLab.Parameters-3.3
+
+
+ {94186A6A-5176-4402-AE83-886557B53CCA}
+ HeuristicLab.PluginInfrastructure-3.3
+
+
+ {3540E29E-4793-49E7-8EE2-FEA7F61C3994}
+ HeuristicLab.Problems.Instances-3.3
+
+
+ {8A7C524C-4B72-45FD-8274-EFB67C27C169}
+ HeuristicLab.Problems.LinearAssignment.Views-3.3
+
+
+ {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372}
+ HeuristicLab.Problems.Orienteering-3.3
+
+
+
+
+ set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+
+call PreBuildEvent.cmd
+
+
+
+
Index: /trunk/sources/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringProblemView.Designer.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringProblemView.Designer.cs (revision 12722)
+++ /trunk/sources/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringProblemView.Designer.cs (revision 12722)
@@ -0,0 +1,151 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.Problems.Orienteering.Views {
+ partial class OrienteeringProblemView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.tabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl();
+ this.parametersTabPage = new System.Windows.Forms.TabPage();
+ this.visualizationTabPage = new System.Windows.Forms.TabPage();
+ this.orienteeringSolutionView = new HeuristicLab.Problems.Orienteering.Views.OrienteeringSolutionView();
+ ((System.ComponentModel.ISupportInitialize)(this.problemInstanceSplitContainer)).BeginInit();
+ this.problemInstanceSplitContainer.Panel1.SuspendLayout();
+ this.problemInstanceSplitContainer.Panel2.SuspendLayout();
+ this.problemInstanceSplitContainer.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
+ this.tabControl.SuspendLayout();
+ this.parametersTabPage.SuspendLayout();
+ this.visualizationTabPage.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // problemInstanceSplitContainer
+ //
+ //
+ // problemInstanceSplitContainer.Panel2
+ //
+ this.problemInstanceSplitContainer.Panel2.Controls.Add(this.tabControl);
+ //
+ // parameterCollectionView
+ //
+ this.parameterCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
+ this.parameterCollectionView.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.parameterCollectionView.Location = new System.Drawing.Point(3, 3);
+ this.parameterCollectionView.Size = new System.Drawing.Size(497, 274);
+ //
+ // nameTextBox
+ //
+ this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
+ this.errorProvider.SetIconPadding(this.nameTextBox, 2);
+ //
+ // tabControl
+ //
+ this.tabControl.AllowDrop = true;
+ this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.tabControl.Controls.Add(this.parametersTabPage);
+ this.tabControl.Controls.Add(this.visualizationTabPage);
+ this.tabControl.Location = new System.Drawing.Point(0, 27);
+ this.tabControl.Name = "tabControl";
+ this.tabControl.SelectedIndex = 0;
+ this.tabControl.Size = new System.Drawing.Size(511, 306);
+ this.tabControl.TabIndex = 4;
+ //
+ // parametersTabPage
+ //
+ this.parametersTabPage.Controls.Add(this.parameterCollectionView);
+ this.parametersTabPage.Location = new System.Drawing.Point(4, 22);
+ this.parametersTabPage.Name = "parametersTabPage";
+ this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3);
+ this.parametersTabPage.Size = new System.Drawing.Size(503, 280);
+ this.parametersTabPage.TabIndex = 0;
+ this.parametersTabPage.Text = "Parameters";
+ this.parametersTabPage.UseVisualStyleBackColor = true;
+ //
+ // visualizationTabPage
+ //
+ this.visualizationTabPage.Controls.Add(this.orienteeringSolutionView);
+ this.visualizationTabPage.Location = new System.Drawing.Point(4, 22);
+ this.visualizationTabPage.Name = "visualizationTabPage";
+ this.visualizationTabPage.Padding = new System.Windows.Forms.Padding(3);
+ this.visualizationTabPage.Size = new System.Drawing.Size(503, 280);
+ this.visualizationTabPage.TabIndex = 1;
+ this.visualizationTabPage.Text = "Visualization";
+ this.visualizationTabPage.UseVisualStyleBackColor = true;
+ //
+ // orienteeringSolutionView
+ //
+ this.orienteeringSolutionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.orienteeringSolutionView.Caption = "OrienteeringSolution View";
+ this.orienteeringSolutionView.Content = null;
+ this.orienteeringSolutionView.Location = new System.Drawing.Point(6, 6);
+ this.orienteeringSolutionView.Name = "orienteeringSolutionView";
+ this.orienteeringSolutionView.ReadOnly = false;
+ this.orienteeringSolutionView.Size = new System.Drawing.Size(491, 268);
+ this.orienteeringSolutionView.TabIndex = 0;
+ //
+ // TravelingSalesmanProblemView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
+ this.Name = "OrienteeringProblemView";
+ this.problemInstanceSplitContainer.Panel1.ResumeLayout(false);
+ this.problemInstanceSplitContainer.Panel1.PerformLayout();
+ this.problemInstanceSplitContainer.Panel2.ResumeLayout(false);
+ this.problemInstanceSplitContainer.Panel2.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.problemInstanceSplitContainer)).EndInit();
+ this.problemInstanceSplitContainer.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
+ this.tabControl.ResumeLayout(false);
+ this.parametersTabPage.ResumeLayout(false);
+ this.visualizationTabPage.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private HeuristicLab.MainForm.WindowsForms.DragOverTabControl tabControl;
+ private System.Windows.Forms.TabPage parametersTabPage;
+ private System.Windows.Forms.TabPage visualizationTabPage;
+ private OrienteeringSolutionView orienteeringSolutionView;
+ }
+}
Index: /trunk/sources/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringProblemView.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringProblemView.cs (revision 12722)
+++ /trunk/sources/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringProblemView.cs (revision 12722)
@@ -0,0 +1,115 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using HeuristicLab.MainForm;
+using HeuristicLab.Optimization.Views;
+
+namespace HeuristicLab.Problems.Orienteering.Views {
+ [View("Orienteering Problem View")]
+ [Content(typeof(OrienteeringProblem), true)]
+ public partial class OrienteeringProblemView : ProblemView {
+ public new OrienteeringProblem Content {
+ get { return (OrienteeringProblem)base.Content; }
+ set { base.Content = value; }
+ }
+
+ public OrienteeringProblemView() {
+ InitializeComponent();
+ }
+
+ protected override void DeregisterContentEvents() {
+ Content.CoordinatesParameter.ValueChanged -= CoordinatesParameter_ValueChanged;
+ Content.StartingPointParameter.ValueChanged -= StartingPointParameter_ValueChanged;
+ Content.TerminalPointParameter.ValueChanged -= TerminalPointParameter_ValueChanged;
+ Content.ScoresParameter.ValueChanged -= ScoresParameter_ValueChanged;
+ Content.BestKnownQualityParameter.ValueChanged -= BestKnownQualityParameter_ValueChanged;
+ Content.BestKnownSolutionParameter.ValueChanged -= BestKnownSolutionParameter_ValueChanged;
+ base.DeregisterContentEvents();
+ }
+ protected override void RegisterContentEvents() {
+ base.RegisterContentEvents();
+ Content.CoordinatesParameter.ValueChanged += CoordinatesParameter_ValueChanged;
+ Content.StartingPointParameter.ValueChanged += StartingPointParameter_ValueChanged;
+ Content.TerminalPointParameter.ValueChanged += TerminalPointParameter_ValueChanged;
+ Content.ScoresParameter.ValueChanged += ScoresParameter_ValueChanged;
+ Content.BestKnownQualityParameter.ValueChanged += BestKnownQualityParameter_ValueChanged;
+ Content.BestKnownSolutionParameter.ValueChanged += BestKnownSolutionParameter_ValueChanged;
+ }
+
+ protected override void OnContentChanged() {
+ base.OnContentChanged();
+ if (Content == null) {
+ orienteeringSolutionView.Content = null;
+ } else {
+ orienteeringSolutionView.Content = new OrienteeringSolution(Content.BestKnownSolution,
+ Content.Coordinates, Content.StartingPointParameter.Value, Content.TerminalPointParameter.Value, Content.Scores);
+ if (Content.BestKnownSolution != null) {
+ EvaluateBestSolution();
+ }
+ }
+ }
+
+ protected override void SetEnabledStateOfControls() {
+ base.SetEnabledStateOfControls();
+ orienteeringSolutionView.Enabled = Content != null;
+ }
+
+ private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) {
+ orienteeringSolutionView.Content.Coordinates = Content.Coordinates;
+ }
+
+ private void StartingPointParameter_ValueChanged(object sender, EventArgs e) {
+ orienteeringSolutionView.Content.StartingPoint.Value = Content.StartingPoint;
+ }
+
+ private void TerminalPointParameter_ValueChanged(object sender, EventArgs e) {
+ orienteeringSolutionView.Content.TerminalPoint.Value = Content.TerminalPoint;
+ }
+
+ private void ScoresParameter_ValueChanged(object sender, EventArgs e) {
+ orienteeringSolutionView.Content.Scores = Content.Scores;
+ }
+
+ private void BestKnownQualityParameter_ValueChanged(object sender, EventArgs e) {
+ orienteeringSolutionView.Content.Quality = Content.BestKnownQuality;
+ }
+
+ private void BestKnownSolutionParameter_ValueChanged(object sender, EventArgs e) {
+ orienteeringSolutionView.Content.IntegerVector = Content.BestKnownSolution;
+ if (Content.BestKnownSolution != null)
+ EvaluateBestSolution();
+ else {
+ var solution = orienteeringSolutionView.Content;
+ solution.Penalty = null;
+ solution.Distance = null;
+ }
+ }
+
+ private void EvaluateBestSolution() {
+ var evaluation = Content.Evaluator.Evaluate(Content.BestKnownSolution, Content.Scores, Content.DistanceMatrix,
+ Content.MaximumDistance, Content.PointVisitingCosts);
+ orienteeringSolutionView.Content.Quality = evaluation.Quality;
+ orienteeringSolutionView.Content.Penalty = evaluation.Penalty;
+ orienteeringSolutionView.Content.Distance = evaluation.Distance;
+ }
+ }
+}
Index: /trunk/sources/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringSolutionView.Designer.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringSolutionView.Designer.cs (revision 12722)
+++ /trunk/sources/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringSolutionView.Designer.cs (revision 12722)
@@ -0,0 +1,278 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.Problems.Orienteering.Views {
+ partial class OrienteeringSolutionView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.pictureBox = new System.Windows.Forms.PictureBox();
+ this.tabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl();
+ this.visualizationTabPage = new System.Windows.Forms.TabPage();
+ this.valueTabPage = new System.Windows.Forms.TabPage();
+ this.tourGroupBox = new System.Windows.Forms.GroupBox();
+ this.tourViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
+ this.splitContainer = new System.Windows.Forms.SplitContainer();
+ this.qualityValueView = new HeuristicLab.Data.Views.StringConvertibleValueView();
+ this.distanceValueView = new HeuristicLab.Data.Views.StringConvertibleValueView();
+ this.penaltyValueView = new HeuristicLab.Data.Views.StringConvertibleValueView();
+ this.qualityLabel = new System.Windows.Forms.Label();
+ this.distanceLabel = new System.Windows.Forms.Label();
+ this.penaltyLabel = new System.Windows.Forms.Label();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
+ this.tabControl.SuspendLayout();
+ this.visualizationTabPage.SuspendLayout();
+ this.valueTabPage.SuspendLayout();
+ this.tourGroupBox.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
+ this.splitContainer.Panel1.SuspendLayout();
+ this.splitContainer.Panel2.SuspendLayout();
+ this.splitContainer.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // pictureBox
+ //
+ this.pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.pictureBox.BackColor = System.Drawing.Color.White;
+ this.pictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.pictureBox.Location = new System.Drawing.Point(6, 6);
+ this.pictureBox.Name = "pictureBox";
+ this.pictureBox.Size = new System.Drawing.Size(403, 271);
+ this.pictureBox.TabIndex = 0;
+ this.pictureBox.TabStop = false;
+ this.pictureBox.SizeChanged += new System.EventHandler(this.pictureBox_SizeChanged);
+ //
+ // tabControl
+ //
+ this.tabControl.AllowDrop = true;
+ this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.tabControl.Controls.Add(this.visualizationTabPage);
+ this.tabControl.Controls.Add(this.valueTabPage);
+ this.tabControl.Location = new System.Drawing.Point(0, 3);
+ this.tabControl.Name = "tabControl";
+ this.tabControl.SelectedIndex = 0;
+ this.tabControl.Size = new System.Drawing.Size(423, 305);
+ this.tabControl.TabIndex = 0;
+ //
+ // visualizationTabPage
+ //
+ this.visualizationTabPage.Controls.Add(this.pictureBox);
+ this.visualizationTabPage.Location = new System.Drawing.Point(4, 22);
+ this.visualizationTabPage.Name = "visualizationTabPage";
+ this.visualizationTabPage.Padding = new System.Windows.Forms.Padding(3);
+ this.visualizationTabPage.Size = new System.Drawing.Size(415, 279);
+ this.visualizationTabPage.TabIndex = 0;
+ this.visualizationTabPage.Text = "Visualization";
+ this.visualizationTabPage.UseVisualStyleBackColor = true;
+ //
+ // valueTabPage
+ //
+ this.valueTabPage.Controls.Add(this.tourGroupBox);
+ this.valueTabPage.Location = new System.Drawing.Point(4, 22);
+ this.valueTabPage.Name = "valueTabPage";
+ this.valueTabPage.Padding = new System.Windows.Forms.Padding(3);
+ this.valueTabPage.Size = new System.Drawing.Size(211, 370);
+ this.valueTabPage.TabIndex = 1;
+ this.valueTabPage.Text = "Value";
+ this.valueTabPage.UseVisualStyleBackColor = true;
+ //
+ // tourGroupBox
+ //
+ this.tourGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.tourGroupBox.Controls.Add(this.tourViewHost);
+ this.tourGroupBox.Location = new System.Drawing.Point(6, 6);
+ this.tourGroupBox.Name = "tourGroupBox";
+ this.tourGroupBox.Size = new System.Drawing.Size(199, 358);
+ this.tourGroupBox.TabIndex = 0;
+ this.tourGroupBox.TabStop = false;
+ this.tourGroupBox.Text = "Tour";
+ //
+ // tourViewHost
+ //
+ this.tourViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.tourViewHost.Caption = "View";
+ this.tourViewHost.Content = null;
+ this.tourViewHost.Enabled = false;
+ this.tourViewHost.Location = new System.Drawing.Point(6, 19);
+ this.tourViewHost.Name = "tourViewHost";
+ this.tourViewHost.ReadOnly = false;
+ this.tourViewHost.Size = new System.Drawing.Size(187, 333);
+ this.tourViewHost.TabIndex = 0;
+ this.tourViewHost.ViewsLabelVisible = true;
+ this.tourViewHost.ViewType = null;
+ //
+ // splitContainer
+ //
+ this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
+ this.splitContainer.Location = new System.Drawing.Point(0, 0);
+ this.splitContainer.Name = "splitContainer";
+ this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
+ //
+ // splitContainer.Panel1
+ //
+ this.splitContainer.Panel1.Controls.Add(this.penaltyLabel);
+ this.splitContainer.Panel1.Controls.Add(this.distanceLabel);
+ this.splitContainer.Panel1.Controls.Add(this.qualityLabel);
+ this.splitContainer.Panel1.Controls.Add(this.qualityValueView);
+ this.splitContainer.Panel1.Controls.Add(this.distanceValueView);
+ this.splitContainer.Panel1.Controls.Add(this.penaltyValueView);
+ this.splitContainer.Panel1.Margin = new System.Windows.Forms.Padding(0, 0, 5, 0);
+ this.splitContainer.Panel1MinSize = 0;
+ //
+ // splitContainer.Panel2
+ //
+ this.splitContainer.Panel2.Controls.Add(this.tabControl);
+ this.splitContainer.Size = new System.Drawing.Size(423, 402);
+ this.splitContainer.SplitterDistance = 87;
+ this.splitContainer.TabIndex = 0;
+ //
+ // qualityValueView
+ //
+ this.qualityValueView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.qualityValueView.Caption = "StringConvertibleValue View";
+ this.qualityValueView.Content = null;
+ this.qualityValueView.LabelVisible = false;
+ this.qualityValueView.Location = new System.Drawing.Point(65, 7);
+ this.qualityValueView.Name = "qualityValueView";
+ this.qualityValueView.ReadOnly = false;
+ this.qualityValueView.Size = new System.Drawing.Size(354, 21);
+ this.qualityValueView.TabIndex = 0;
+ //
+ // distanceValueView
+ //
+ this.distanceValueView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.distanceValueView.Caption = "StringConvertibleValue View";
+ this.distanceValueView.Content = null;
+ this.distanceValueView.LabelVisible = false;
+ this.distanceValueView.Location = new System.Drawing.Point(65, 34);
+ this.distanceValueView.Name = "distanceValueView";
+ this.distanceValueView.ReadOnly = false;
+ this.distanceValueView.Size = new System.Drawing.Size(354, 21);
+ this.distanceValueView.TabIndex = 0;
+ //
+ // penaltyValueView
+ //
+ this.penaltyValueView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.penaltyValueView.Caption = "StringConvertibleValue View";
+ this.penaltyValueView.Content = null;
+ this.penaltyValueView.LabelVisible = false;
+ this.penaltyValueView.Location = new System.Drawing.Point(65, 61);
+ this.penaltyValueView.Name = "penaltyValueView";
+ this.penaltyValueView.ReadOnly = false;
+ this.penaltyValueView.Size = new System.Drawing.Size(354, 21);
+ this.penaltyValueView.TabIndex = 0;
+ //
+ // qualityLabel
+ //
+ this.qualityLabel.AutoSize = true;
+ this.qualityLabel.Location = new System.Drawing.Point(7, 11);
+ this.qualityLabel.Name = "qualityLabel";
+ this.qualityLabel.Size = new System.Drawing.Size(42, 13);
+ this.qualityLabel.TabIndex = 1;
+ this.qualityLabel.Text = "Quality:";
+ //
+ // distanceLabel
+ //
+ this.distanceLabel.AutoSize = true;
+ this.distanceLabel.Location = new System.Drawing.Point(7, 38);
+ this.distanceLabel.Name = "distanceLabel";
+ this.distanceLabel.Size = new System.Drawing.Size(52, 13);
+ this.distanceLabel.TabIndex = 1;
+ this.distanceLabel.Text = "Distance:";
+ //
+ // penaltyLabel
+ //
+ this.penaltyLabel.AutoSize = true;
+ this.penaltyLabel.Location = new System.Drawing.Point(7, 64);
+ this.penaltyLabel.Name = "penaltyLabel";
+ this.penaltyLabel.Size = new System.Drawing.Size(45, 13);
+ this.penaltyLabel.TabIndex = 1;
+ this.penaltyLabel.Text = "Penalty:";
+ //
+ // OrienteeringSolutionView
+ //
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
+ this.Controls.Add(this.splitContainer);
+ this.Name = "OrienteeringSolutionView";
+ this.Size = new System.Drawing.Size(423, 402);
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
+ this.tabControl.ResumeLayout(false);
+ this.visualizationTabPage.ResumeLayout(false);
+ this.valueTabPage.ResumeLayout(false);
+ this.tourGroupBox.ResumeLayout(false);
+ this.splitContainer.Panel1.ResumeLayout(false);
+ this.splitContainer.Panel1.PerformLayout();
+ this.splitContainer.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
+ this.splitContainer.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.PictureBox pictureBox;
+ private HeuristicLab.MainForm.WindowsForms.DragOverTabControl tabControl;
+ private System.Windows.Forms.TabPage visualizationTabPage;
+ private System.Windows.Forms.TabPage valueTabPage;
+ private System.Windows.Forms.GroupBox tourGroupBox;
+ private HeuristicLab.MainForm.WindowsForms.ViewHost tourViewHost;
+ private System.Windows.Forms.SplitContainer splitContainer;
+ private System.Windows.Forms.Label penaltyLabel;
+ private System.Windows.Forms.Label distanceLabel;
+ private System.Windows.Forms.Label qualityLabel;
+ private Data.Views.StringConvertibleValueView qualityValueView;
+ private Data.Views.StringConvertibleValueView distanceValueView;
+ private Data.Views.StringConvertibleValueView penaltyValueView;
+ }
+}
Index: /trunk/sources/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringSolutionView.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringSolutionView.cs (revision 12722)
+++ /trunk/sources/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringSolutionView.cs (revision 12722)
@@ -0,0 +1,224 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Drawing;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core.Views;
+using HeuristicLab.MainForm;
+
+namespace HeuristicLab.Problems.Orienteering.Views {
+ [View("OrienteeringSolution View")]
+ [Content(typeof(OrienteeringSolution), true)]
+ public partial class OrienteeringSolutionView : ItemView {
+ public new OrienteeringSolution Content {
+ get { return (OrienteeringSolution)base.Content; }
+ set { base.Content = value; }
+ }
+ public OrienteeringSolutionView() {
+ InitializeComponent();
+ }
+
+ protected override void DeregisterContentEvents() {
+ Content.QualityChanged -= Content_QualityChanged;
+ Content.PenaltyChanged -= Content_PenaltyChanged;
+ Content.DistanceChanged -= Content_DistanceChanged;
+ Content.CoordinatesChanged -= Content_CoordinatesChanged;
+ Content.StartingPointChanged -= Content_StartingPointChanged;
+ Content.TerminalPointChanged -= Content_TerminalPointChanged;
+ Content.ScoresChanged -= Content_ScoresChanged;
+ Content.IntegerVectorChanged -= Content_IntegerVectorChanged;
+ base.DeregisterContentEvents();
+ }
+ protected override void RegisterContentEvents() {
+ base.RegisterContentEvents();
+ Content.QualityChanged += Content_QualityChanged;
+ Content.PenaltyChanged += Content_PenaltyChanged;
+ Content.DistanceChanged += Content_DistanceChanged;
+ Content.CoordinatesChanged += Content_CoordinatesChanged;
+ Content.StartingPointChanged += Content_StartingPointChanged;
+ Content.TerminalPointChanged += Content_TerminalPointChanged;
+ Content.ScoresChanged += Content_ScoresChanged;
+ Content.IntegerVectorChanged += Content_IntegerVectorChanged;
+ }
+
+ protected override void OnContentChanged() {
+ base.OnContentChanged();
+ if (Content == null) {
+ qualityValueView.Content = null;
+ penaltyValueView.Content = null;
+ distanceValueView.Content = null;
+ splitContainer.Panel1Collapsed = true;
+ pictureBox.Image = null;
+ tourViewHost.Content = null;
+ } else {
+ qualityValueView.Content = Content.Quality;
+ penaltyValueView.Content = Content.Penalty;
+ distanceValueView.Content = Content.Distance;
+ SetPanelCollapsing();
+ GenerateImage();
+ tourViewHost.Content = Content.IntegerVector;
+ }
+ }
+
+ protected override void SetEnabledStateOfControls() {
+ base.SetEnabledStateOfControls();
+ qualityValueView.Enabled = Content != null;
+ penaltyValueView.Enabled = Content != null;
+ distanceValueView.Enabled = Content != null;
+ pictureBox.Enabled = Content != null;
+ tourGroupBox.Enabled = Content != null;
+ }
+
+ private void GenerateImage() {
+ if ((pictureBox.Width > 0) && (pictureBox.Height > 0)) {
+ if (Content == null) {
+ pictureBox.Image = null;
+ } else {
+ var coordinates = Content.Coordinates;
+ var scores = Content.Scores;
+ var integerVector = Content.IntegerVector;
+ var bitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
+
+ if ((coordinates != null) && (coordinates.Rows > 0) && (coordinates.Columns == 2)
+ && (scores != null) && (coordinates.Rows == scores.Length)) {
+ double xMin = double.MaxValue, yMin = double.MaxValue, xMax = double.MinValue, yMax = double.MinValue;
+ for (int i = 0; i < coordinates.Rows; i++) {
+ if (xMin > coordinates[i, 0]) xMin = coordinates[i, 0];
+ if (yMin > coordinates[i, 1]) yMin = coordinates[i, 1];
+ if (xMax < coordinates[i, 0]) xMax = coordinates[i, 0];
+ if (yMax < coordinates[i, 1]) yMax = coordinates[i, 1];
+ }
+
+ int border = 20;
+ double xStep = xMax != xMin ? (pictureBox.Width - 2 * border) / (xMax - xMin) : 1;
+ double yStep = yMax != yMin ? (pictureBox.Height - 2 * border) / (yMax - yMin) : 1;
+
+ Point[] points = new Point[coordinates.Rows];
+ for (int i = 0; i < coordinates.Rows; i++)
+ points[i] = new Point(border + ((int)((coordinates[i, 0] - xMin) * xStep)),
+ bitmap.Height - (border + ((int)((coordinates[i, 1] - yMin) * yStep))));
+
+ using (Graphics graphics = Graphics.FromImage(bitmap)) {
+ if (integerVector != null && integerVector.Length > 1) {
+ Point[] tour = new Point[integerVector.Length];
+ for (int i = 0; i < integerVector.Length; i++) {
+ tour[i] = points[integerVector[i]];
+ }
+ bool visualizePenalty = Content.Penalty != null && Content.Penalty.Value > 0;
+ graphics.DrawLines(visualizePenalty ? Pens.Red : Pens.Black, tour);
+ }
+
+ double scoreMin = scores.Min();
+ double scoreMax = scores.Max();
+ double scoreRange = scoreMax - scoreMin;
+ for (int i = 0; i < points.Length; i++) {
+ double score = scores[i];
+ int size = scoreRange.IsAlmost(0.0)
+ ? 6
+ : (int)Math.Round(((score - scoreMin) / scoreRange) * 8 + 2);
+ graphics.FillRectangle(Brushes.Red, points[i].X - size / 2, points[i].Y - size / 2, size, size);
+ }
+ int startingPoint = Content.StartingPoint.Value;
+ int terminalPoint = Content.TerminalPoint.Value;
+ Font font = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular);
+ var beginSize = graphics.MeasureString("Begin", font);
+ if (startingPoint >= 0 && startingPoint < points.Length)
+ graphics.DrawString("Begin", font, Brushes.Black, points[startingPoint].X - beginSize.Width, points[startingPoint].Y - beginSize.Height);
+ if (terminalPoint >= 0 && terminalPoint < points.Length)
+ graphics.DrawString("End", font, Brushes.Black, points[terminalPoint].X, points[terminalPoint].Y);
+ }
+ } else {
+ using (Graphics graphics = Graphics.FromImage(bitmap)) {
+ graphics.Clear(Color.White);
+ Font font = new Font(FontFamily.GenericSansSerif, 12, FontStyle.Regular);
+ string text = "No coordinates defined or in wrong format.";
+ SizeF strSize = graphics.MeasureString(text, font);
+ graphics.DrawString(text, font, Brushes.Black, (float)(pictureBox.Width - strSize.Width) / 2.0f, (float)(pictureBox.Height - strSize.Height) / 2.0f);
+ }
+ }
+ pictureBox.Image = bitmap;
+ }
+ }
+ }
+
+ private void SetPanelCollapsing() {
+ splitContainer.Panel1Collapsed = qualityValueView.Content == null && penaltyValueView.Content == null && distanceValueView.Content == null;
+ }
+
+ private void Content_QualityChanged(object sender, EventArgs e) {
+ if (InvokeRequired) Invoke((Action