Changeset 11136


Ignore:
Timestamp:
07/08/14 16:02:08 (8 years ago)
Author:
pfleck
Message:

#2208

  • Added Orienteering problem as Script
  • Added Score visualization
  • Merged trunk
Location:
branches/HeuristicLab.Problems.Orienteering
Files:
5 edited
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.Orienteering

  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3

    • Property svn:ignore
      •  

        old new  
        11bin
        22obj
         3Plugin.cs
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/HeuristicLab.Problems.Orienteering-3.3.csproj

    r11134 r11136  
    66    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    77    <ProjectGuid>{D1EFA4CC-909F-41D5-9C1F-C3AF1957A372}</ProjectGuid>
    8     <OutputType>Exe</OutputType>
     8    <OutputType>Library</OutputType>
    99    <AppDesignerFolder>Properties</AppDesignerFolder>
    1010    <RootNamespace>HeuristicLab.Problems.Orienteering</RootNamespace>
     
    4040  </PropertyGroup>
    4141  <ItemGroup>
     42    <Reference Include="Microsoft.CSharp" />
    4243    <Reference Include="System" />
    4344    <Reference Include="System.Core" />
    4445  </ItemGroup>
    4546  <ItemGroup>
    46     <Compile Include="Program.cs" />
     47    <Compile Include="OrienteeringScript.cs" />
     48    <Compile Include="Plugin.cs" />
    4749    <Compile Include="Properties\AssemblyInfo.cs" />
    4850  </ItemGroup>
    4951  <ItemGroup>
    5052    <None Include="HeuristicLab.snk" />
     53    <None Include="Plugin.cs.frame" />
    5154    <None Include="Properties\AssemblyInfo.cs.frame" />
    5255  </ItemGroup>
    5356  <ItemGroup>
     57    <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
     58      <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
     59      <Name>HeuristicLab.Analysis-3.3</Name>
     60    </ProjectReference>
     61    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
     62      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
     63      <Name>HeuristicLab.Collections-3.3</Name>
     64    </ProjectReference>
    5465    <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
    5566      <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
     
    6273      <Private>False</Private>
    6374    </ProjectReference>
     75    <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
     76      <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
     77      <Name>HeuristicLab.Data-3.3</Name>
     78    </ProjectReference>
     79    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
     80      <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
     81      <Name>HeuristicLab.Optimization-3.3</Name>
     82    </ProjectReference>
     83    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
     84      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
     85      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
     86    </ProjectReference>
    6487    <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">
    6588      <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project>
    6689      <Name>HeuristicLab.Random-3.3</Name>
    6790      <Private>False</Private>
     91    </ProjectReference>
     92    <ProjectReference Include="..\..\HeuristicLab.Scripting\3.3\HeuristicLab.Scripting-3.3.csproj">
     93      <Project>{21977CC3-1757-4B3B-87BD-FF817AAA900F}</Project>
     94      <Name>HeuristicLab.Scripting-3.3</Name>
    6895    </ProjectReference>
    6996  </ItemGroup>
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/OrienteeringScript.cs

    r11135 r11136  
    2626using System.Linq;
    2727using System.Threading;
     28using HeuristicLab.Analysis;
     29using HeuristicLab.Core;
     30using HeuristicLab.Optimization;
    2831using HeuristicLab.Random;
     32using HeuristicLab.Scripting;
    2933
    3034namespace HeuristicLab.Problems.Orienteering {
     
    4347   * Michael Schilde, Karl F. Doerner, Richard F. Hartl, Guenter Kiechle
    4448   */
    45   public class Program {
     49  public class OrienteeringScript : CSharpScriptBase {
    4650    #region Constants
    4751
     
    5357
    5458    private const int ConstraintTimeDistance = -1;
     59
     60    private static readonly TimeSpan RunDuration = TimeSpan.FromSeconds(15);
    5561
    5662    public enum ErrorCode {
     
    8793
    8894    #region Fields
    89     private static TimeSpan avgTimeDurationVns;
    90     private static List<TimeSpan> timeDurationVns = new List<TimeSpan>();
    91     private static List<int> solutionsFoundVns = new List<int>();
    92     private static List<List<TourData>> TourBackupVNS = new List<List<TourData>>();
    93     private static List<int> solutionsFoundPrVns = new List<int>();
    94     private static List<ProblemData> problems = new List<ProblemData>();
    95     private static double averageScoreVns;
    96     private static double bestScoreVns;
    97     private static TimeSpan timeOfBestScoreVns;
    98     private static double worstScoreVns;
     95    private TimeSpan avgTimeDurationVns;
     96    private List<TimeSpan> timeDurationVns = new List<TimeSpan>();
     97    private List<int> solutionsFoundVns = new List<int>();
     98    private List<List<TourData>> TourBackupVNS = new List<List<TourData>>();
     99    private List<int> solutionsFoundPrVns = new List<int>();
     100    private List<ProblemData> problems = new List<ProblemData>();
     101    private double averageScoreVns;
     102    private double bestScoreVns;
     103    private TimeSpan timeOfBestScoreVns;
     104    private double worstScoreVns;
     105
     106    private ItemList<IItem> results;
     107    private DataTable scores;
     108
    99109    #endregion
    100110
    101     static void Main() {
     111    public override void Main() {
    102112      Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
    103113
     114      vars.Clear();
     115
    104116      const int numberOfRuns = 10;
    105       const string inputFilename = @"C:\Users\P41107\Desktop\moop\1 objective\1_p21\1_p21_t015.txt";
     117      const string inputFilename = @"C:\Users\P41107\Desktop\moop\1 objective\1_p66\1_p66_t080.txt";
    106118      const string csvFilename = @"C:\temp\results1.csv";
    107119      const string summaryFilename = @"C:\temp\summary.csv";
     
    113125      const double maximumDistanceOverride = 0.0;
    114126      const bool performPathRelinkingComparison = true;
    115       TimeSpan runDuration = TimeSpan.FromSeconds(15);
    116127
    117128      string testInstanceName = inputFilename.Contains(@"\")
     
    119130        : inputFilename.Substring(inputFilename.LastIndexOf(@"/") + 1);
    120131
     132      bool csvExists = File.Exists(summaryFilename);
    121133
    122134      // Open the results CSV file for writing the data
    123       var csvFile = new StreamWriter(new FileStream(csvFilename, FileMode.Create));
     135      using (var csvFile = new StreamWriter(new FileStream(csvFilename, FileMode.Create)))
    124136      // Open the summary CSV file for appending the data
    125       bool csvExists = File.Exists(summaryFilename);
    126       var summaryFile = new StreamWriter(new FileStream(summaryFilename, FileMode.OpenOrCreate));
    127 
    128       // Remember the overall starting time
    129       var startOverall = DateTime.Now.Ticks;
    130 
    131       for (int runCounter = 0; runCounter < numberOfRuns; runCounter++) {
    132         // Print out a status information
    133         if (ShowStatus)
    134           Console.WriteLine("Run {0} started.", (runCounter + 1));
    135 
    136         // Create a new problem data container
    137         var problem = new ProblemData {
    138           FixedPenalty = fixedVisitingTime,
    139           Constraints = new List<ConstraintData>(),
    140           Points = new List<PointData>(),
    141           Edges = new List<List<EdgeData>>(),
    142           MTR = new MersenneTwister(),
    143           VNS = new VnsData {
    144             NumberOfIterations = numberOfIterations,
    145             AcceptFrequency = acceptFrequency,
    146             TresholdValue = tresholdValue,
    147             InitialTour = new TourData { Path = new List<int>(), Scores = new List<int>() },
    148             DominantTours = new List<TourData>()
    149           },
    150         };
    151 
    152         // Do the initialization
    153         ErrorCode errorCode = LoadData(inputFilename, problem);
    154         if (errorCode != 0) {
    155           Console.WriteLine("Initialization failed. (Code: {0})", errorCode);
    156           Console.WriteLine(GetErrorDescription(errorCode));
    157           Console.WriteLine("Exiting.");
    158           return;
    159         }
    160 
    161         // Override the distance limit from file by parameter if specified
    162         if (maximumDistanceOverride > 0.0) {
    163           problem.Constraints.Clear();
    164           problem.Constraints.Add(new ConstraintData {
    165             Type = Constraint.Upperbound,
    166             Target = -1,
    167             TargetValue = maximumDistanceOverride
    168           });
    169         }
    170 
    171         if (ShowStatus)
    172           Console.WriteLine("\tVNS started.");
    173 
    174         // Run the VNS algorithm
    175         var startPart = DateTime.Now.Ticks;
    176         var durationPart = runDuration.Ticks;
    177         RunVns(problem, startPart, durationPart);
    178         var endPart = DateTime.Now.Ticks;
    179         var temp = CalculateDifference(startPart, endPart);
    180         avgTimeDurationVns += temp;
    181         timeDurationVns.Add(temp);
    182         solutionsFoundVns.Add((int)problem.VNS.DominantTours.Count);
    183 
    184         if (ShowStatus)
    185           Console.WriteLine("\tVNS completed ({0} Tours in {1:g}).", problem.VNS.DominantTours.Count, temp);
    186 
    187         if (performPathRelinkingComparison) {
    188           // Backup original VNS results
    189           TourBackupVNS.Add(problem.VNS.DominantTours);
    190         }
    191 
    192         // If we have two objectives, run path relinking
    193         if (problem.ScoreCount == 2) {
    194           // Run the path relinking for the VNS solutions
     137      using (var summaryFile = new StreamWriter(new FileStream(summaryFilename, FileMode.OpenOrCreate))) {
     138
     139        // Remember the overall starting time
     140        var startOverall = DateTime.Now.Ticks;
     141
     142        for (int runCounter = 0; runCounter < numberOfRuns; runCounter++) {
     143          // Print out a status information
    195144          if (ShowStatus)
    196             Console.WriteLine("\tPath relinking for VNS solutions started.");
    197           int toursFoundPrVns = PathRelinking(problem, problem.VNS.DominantTours, startPart);
    198 
    199           temp = CalculateDifference(startPart, DateTime.Now.Ticks) - temp;
    200           solutionsFoundPrVns.Add(toursFoundPrVns);
     145            Console.WriteLine("Run {0} started.", (runCounter + 1));
     146
     147          // Create a new problem data container
     148          var problem = new ProblemData {
     149            FixedPenalty = fixedVisitingTime,
     150            Constraints = new List<ConstraintData>(),
     151            Points = new List<PointData>(),
     152            Edges = new List<List<EdgeData>>(),
     153            MTR = new MersenneTwister(),
     154            VNS = new VnsData {
     155              NumberOfIterations = numberOfIterations,
     156              AcceptFrequency = acceptFrequency,
     157              TresholdValue = tresholdValue,
     158              InitialTour = new TourData { Path = new List<int>(), Scores = new List<int>() },
     159              DominantTours = new List<TourData>()
     160            },
     161          };
     162
     163          // Do the initialization
     164          ErrorCode errorCode = LoadData(inputFilename, problem);
     165          if (errorCode != 0) {
     166            Console.WriteLine("Initialization failed. (Code: {0})", errorCode);
     167            Console.WriteLine(GetErrorDescription(errorCode));
     168            Console.WriteLine("Exiting.");
     169            return;
     170          }
     171
     172          // Override the distance limit from file by parameter if specified
     173          if (maximumDistanceOverride > 0.0) {
     174            problem.Constraints.Clear();
     175            problem.Constraints.Add(new ConstraintData {
     176              Type = Constraint.Upperbound,
     177              Target = -1,
     178              TargetValue = maximumDistanceOverride
     179            });
     180          }
     181
     182          results = new ItemList<IItem>();
     183          vars["run" + runCounter] = results;
     184          scores = new DataTable("Scores");
     185          results.Add(scores);
     186          scores.Rows.AddRange(Enumerable.Range(0, problem.ScoreCount).Select(s => new DataRow("Score " + s)));
     187
    201188          if (ShowStatus)
    202             Console.WriteLine("\tPath relinking for VNS solutions completed ({0} tours in {1:g}).", toursFoundPrVns, temp);
    203         }
    204 
    205         // Store all the information in the run-spanning storage
    206         problems.Add(problem);
    207       }
    208 
    209       // If we have more than one objective, calculate metrics
    210       if (problems[0].ScoreCount == 2) {
    211         if (ShowStatus)
    212           Console.WriteLine("Performing 2-objective post-calculations.");
    213         throw new NotImplementedException();
    214       } else {
    215         if (ShowStatus)
    216           Console.WriteLine("\tPerforming 1-objective post-calculations.");
    217 
    218         // Only one objective value, so just calculate best, average and worst score
    219         for (int counterRuns = 0; counterRuns < numberOfRuns; counterRuns++) {
    220           averageScoreVns += problems[counterRuns].VNS.DominantTours[0].Scores[0];
    221 
    222           if (problems[counterRuns].VNS.DominantTours[0].Scores[0] > bestScoreVns) {
    223             bestScoreVns = problems[counterRuns].VNS.DominantTours[0].Scores[0];
    224             timeOfBestScoreVns = problems[counterRuns].VNS.DominantTours[0].TimeOfAdding;
    225           }
    226           if ((counterRuns == 0) || (problems[counterRuns].VNS.DominantTours[0].Scores[0] < worstScoreVns)) {
    227             worstScoreVns = problems[counterRuns].VNS.DominantTours[0].Scores[0];
    228           }
    229         }
    230 
    231         // Calculate the average computation times
    232         averageScoreVns /= numberOfRuns;
    233 
    234         if (ShowStatus)
    235           Console.WriteLine("\tWriting output files.");
    236 
    237         // Write out the CSV results file
    238         csvFile.WriteLine("Test instance;Tmax;# runs;iter. VNS;accept frequency;treshold");
    239         csvFile.Write(testInstanceName + ";");
    240         csvFile.Write("{0};", problems[0].Constraints[0].TargetValue);
    241         csvFile.Write("{0};", numberOfRuns);
    242         csvFile.Write("{0};", numberOfIterations);
    243         csvFile.Write("{0};", acceptFrequency);
    244         csvFile.Write("{0};", tresholdValue);
    245         csvFile.WriteLine();
    246         csvFile.WriteLine();
    247 
    248         // If we have more than one objective, print out the full detail report
    249         if (problems[0].ScoreCount > 1) {
     189            Console.WriteLine("\tVNS started.");
     190
     191          // Run the VNS algorithm
     192          var startPart = DateTime.Now.Ticks;
     193          var durationPart = RunDuration.Ticks;
     194          RunVns(problem, startPart, durationPart);
     195          var endPart = DateTime.Now.Ticks;
     196          var temp = CalculateDifference(startPart, endPart);
     197          avgTimeDurationVns += temp;
     198          timeDurationVns.Add(temp);
     199          solutionsFoundVns.Add((int)problem.VNS.DominantTours.Count);
     200
     201          if (ShowStatus)
     202            Console.WriteLine("\tVNS completed ({0} Tours in {1:g}).", problem.VNS.DominantTours.Count, temp);
     203
     204          if (performPathRelinkingComparison) {
     205            // Backup original VNS results
     206            TourBackupVNS.Add(problem.VNS.DominantTours);
     207          }
     208
     209          // If we have two objectives, run path relinking
     210          if (problem.ScoreCount == 2) {
     211            // Run the path relinking for the VNS solutions
     212            if (ShowStatus)
     213              Console.WriteLine("\tPath relinking for VNS solutions started.");
     214            int toursFoundPrVns = PathRelinking(problem, problem.VNS.DominantTours, startPart);
     215
     216            temp = CalculateDifference(startPart, DateTime.Now.Ticks) - temp;
     217            solutionsFoundPrVns.Add(toursFoundPrVns);
     218            if (ShowStatus)
     219              Console.WriteLine("\tPath relinking for VNS solutions completed ({0} tours in {1:g}).", toursFoundPrVns, temp);
     220          }
     221
     222          // Store all the information in the run-spanning storage
     223          problems.Add(problem);
     224        }
     225
     226        // If we have more than one objective, calculate metrics
     227        if (problems[0].ScoreCount == 2) {
     228          if (ShowStatus)
     229            Console.WriteLine("Performing 2-objective post-calculations.");
    250230          throw new NotImplementedException();
    251231        } else {
    252           // Only one objective, so print out the short report only
    253           csvFile.WriteLine("Run;CPU VNS;Score VNS");
     232          if (ShowStatus)
     233            Console.WriteLine("\tPerforming 1-objective post-calculations.");
     234
     235          // Only one objective value, so just calculate best, average and worst score
    254236          for (int counterRuns = 0; counterRuns < numberOfRuns; counterRuns++) {
    255             csvFile.Write("{0};", counterRuns + 1); // Number of runs
    256             csvFile.Write("{0};", timeDurationVns[counterRuns]);      // CPU VNS
    257             csvFile.Write("{0};", problems[counterRuns].VNS.DominantTours[0].Scores[0]);        // Score VNS
    258             //csv_file << convert_locale(time_of_best_score_aco) << ";";          // Runtime until finding best tour ACO
    259             //csv_file << convert_locale(time_of_best_score_vns) << ";";          // Runtime until finding best tour VNS
     237            averageScoreVns += problems[counterRuns].VNS.DominantTours[0].Scores[0];
     238
     239            if (problems[counterRuns].VNS.DominantTours[0].Scores[0] > bestScoreVns) {
     240              bestScoreVns = problems[counterRuns].VNS.DominantTours[0].Scores[0];
     241              timeOfBestScoreVns = problems[counterRuns].VNS.DominantTours[0].TimeOfAdding;
     242            }
     243            if ((counterRuns == 0) || (problems[counterRuns].VNS.DominantTours[0].Scores[0] < worstScoreVns)) {
     244              worstScoreVns = problems[counterRuns].VNS.DominantTours[0].Scores[0];
     245            }
     246          }
     247
     248          // Calculate the average computation times
     249          averageScoreVns /= numberOfRuns;
     250
     251          if (ShowStatus)
     252            Console.WriteLine("\tWriting output files.");
     253
     254          // Write out the CSV results file
     255          csvFile.WriteLine("Test instance;Tmax;# runs;iter. VNS;accept frequency;treshold");
     256          csvFile.Write(testInstanceName + ";");
     257          csvFile.Write("{0};", problems[0].Constraints[0].TargetValue);
     258          csvFile.Write("{0};", numberOfRuns);
     259          csvFile.Write("{0};", numberOfIterations);
     260          csvFile.Write("{0};", acceptFrequency);
     261          csvFile.Write("{0};", tresholdValue);
     262          csvFile.WriteLine();
     263          csvFile.WriteLine();
     264
     265          // If we have more than one objective, print out the full detail report
     266          if (problems[0].ScoreCount > 1) {
     267            throw new NotImplementedException();
     268          } else {
     269            // Only one objective, so print out the short report only
     270            csvFile.WriteLine("Run;CPU VNS;Score VNS");
     271            for (int counterRuns = 0; counterRuns < numberOfRuns; counterRuns++) {
     272              csvFile.Write("{0};", counterRuns + 1); // Number of runs
     273              csvFile.Write("{0};", timeDurationVns[counterRuns]); // CPU VNS
     274              csvFile.Write("{0};", problems[counterRuns].VNS.DominantTours[0].Scores[0]); // Score VNS
     275              //csv_file << convert_locale(time_of_best_score_aco) << ";";          // Runtime until finding best tour ACO
     276              //csv_file << convert_locale(time_of_best_score_vns) << ";";          // Runtime until finding best tour VNS
     277              csvFile.WriteLine();
     278            }
    260279            csvFile.WriteLine();
    261           }
    262           csvFile.WriteLine();
    263           for (int counterRuns = 0; counterRuns < numberOfRuns; counterRuns++) {
    264             csvFile.WriteLine("Run;{0}", counterRuns + 1);
    265             csvFile.WriteLine(";;Length;Time Of Adding;Score;Path");
    266             csvFile.Write(";;");
    267 
    268 
    269             csvFile.WriteLine();
    270             csvFile.WriteLine();
    271 
    272             csvFile.WriteLine(";Tour VNS");
    273             csvFile.WriteLine(";;Length;Time Of Adding;Score;Path");
    274             csvFile.Write(";;");
    275             csvFile.Write("{0};", problems[counterRuns].VNS.DominantTours[0].Length);
    276             csvFile.Write("{0};", problems[counterRuns].VNS.DominantTours[0].TimeOfAdding);
    277             csvFile.Write("{0};", problems[counterRuns].VNS.DominantTours[0].Scores[0]);
    278             csvFile.Write("{0}", problems[counterRuns].VNS.DominantTours[0].Path[0]);
    279             for (int counterPoints = 1; counterPoints < problems[counterRuns].VNS.DominantTours[0].PathSize; counterPoints++) {
    280               csvFile.Write("-{0}", problems[counterRuns].VNS.DominantTours[0].Path[counterPoints]);
    281             }
    282             csvFile.WriteLine();
    283             csvFile.WriteLine();
    284           }
    285           // Append the CSV summary file information
    286           if (!csvExists) {
    287             summaryFile.Write("Test instance;Tmax;# runs;iter. VNS;accept frequency;treshold;");
    288             summaryFile.Write("avg. CPU VNS;max score VNS;avg. score VNS;min score VNS;time of adding best tour VNS");
     280            for (int counterRuns = 0; counterRuns < numberOfRuns; counterRuns++) {
     281              csvFile.WriteLine("Run;{0}", counterRuns + 1);
     282              csvFile.WriteLine(";;Length;Time Of Adding;Score;Path");
     283              csvFile.Write(";;");
     284
     285
     286              csvFile.WriteLine();
     287              csvFile.WriteLine();
     288
     289              csvFile.WriteLine(";Tour VNS");
     290              csvFile.WriteLine(";;Length;Time Of Adding;Score;Path");
     291              csvFile.Write(";;");
     292              csvFile.Write("{0};", problems[counterRuns].VNS.DominantTours[0].Length);
     293              csvFile.Write("{0};", problems[counterRuns].VNS.DominantTours[0].TimeOfAdding);
     294              csvFile.Write("{0};", problems[counterRuns].VNS.DominantTours[0].Scores[0]);
     295              csvFile.Write("{0}", problems[counterRuns].VNS.DominantTours[0].Path[0]);
     296              for (int counterPoints = 1;
     297                counterPoints < problems[counterRuns].VNS.DominantTours[0].PathSize;
     298                counterPoints++) {
     299                csvFile.Write("-{0}", problems[counterRuns].VNS.DominantTours[0].Path[counterPoints]);
     300              }
     301              csvFile.WriteLine();
     302              csvFile.WriteLine();
     303            }
     304            // Append the CSV summary file information
     305            if (!csvExists) {
     306              summaryFile.Write("Test instance;Tmax;# runs;iter. VNS;accept frequency;treshold;");
     307              summaryFile.Write("avg. CPU VNS;max score VNS;avg. score VNS;min score VNS;time of adding best tour VNS");
     308              summaryFile.WriteLine();
     309            }
     310            summaryFile.Write("{0};", testInstanceName);
     311            summaryFile.Write("{0};", problems[0].Constraints[0].TargetValue);
     312            summaryFile.Write("{0};", numberOfRuns);
     313            summaryFile.Write("{0};", numberOfIterations); // number of iterations vns
     314            summaryFile.Write("{0};", acceptFrequency); // accept frequency
     315            summaryFile.Write("{0};", tresholdValue); // treshold value
     316            summaryFile.Write("{0};", avgTimeDurationVns); // CPU VNS
     317            summaryFile.Write("{0};", bestScoreVns); // Best score VNS
     318            summaryFile.Write("{0};", averageScoreVns); // Average score VNS
     319            summaryFile.Write("{0};", worstScoreVns); // Worst score VNS
     320            summaryFile.Write("{0};", timeOfBestScoreVns); // Time until best score VNS
    289321            summaryFile.WriteLine();
    290322          }
    291           summaryFile.Write("{0};", testInstanceName);
    292           summaryFile.Write("{0};", problems[0].Constraints[0].TargetValue);
    293           summaryFile.Write("{0};", numberOfRuns);
    294           summaryFile.Write("{0};", numberOfIterations);                  // number of iterations vns
    295           summaryFile.Write("{0};", acceptFrequency);                 // accept frequency
    296           summaryFile.Write("{0};", tresholdValue);   // treshold value
    297           summaryFile.Write("{0};", avgTimeDurationVns);    // CPU VNS
    298           summaryFile.Write("{0};", bestScoreVns);                // Best score VNS
    299           summaryFile.Write("{0};", averageScoreVns);     // Average score VNS
    300           summaryFile.Write("{0};", worstScoreVns);               // Worst score VNS
    301           summaryFile.Write("{0};", timeOfBestScoreVns);    // Time until best score VNS
    302           summaryFile.WriteLine();
    303         }
    304 
    305         csvFile.Close();
    306         summaryFile.Close();
     323        }
    307324      }
    308325    }
     
    686703    #region VNS
    687704
    688     private static void RunVns(ProblemData problem, long startTime, long maxRuntime) {
     705    private void RunVns(ProblemData problem, long startTime, long maxRuntime) {
    689706      long iterationCounter = 0;
    690707      int neighborhoodMax;
     
    750767          OptimizePath(problem, problem.VNS.ActualTour);
    751768
     769
     770          for (int i = 0; i < problem.ScoreCount; i++)
     771            scores.Rows["Score " + i].Values.Add(problem.VNS.ActualTour.Scores[i]);
     772
    752773          // Save the tour if it is pareto dominant
    753774          if (SaveDominantToursVns(problem, problem.VNS.ActualTour, startTime)) {
     
    782803        }
    783804      }
     805
     806      Console.WriteLine("Time Of Adding of Best Tour: {0}", problem.VNS.DominantTours[0].TimeOfAdding.TotalSeconds);
    784807      //printf("DEBUG: iteration_counter = %d\n", iteration_counter);
    785808    }
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Plugin.cs.frame

    r11132 r11136  
    2222using HeuristicLab.PluginInfrastructure;
    2323
    24 namespace HeuristicLab.Problems.ParameterOptimization {
     24namespace HeuristicLab.Problems.Orienteering {
    2525  /// <summary>
    26   /// Plugin class for HeuristicLab.Problems.ParameterOptimization.
     26  /// Plugin class for HeuristicLab.Problems.Orienteering.
    2727  /// </summary>
    28   [Plugin("HeuristicLab.Problems.ParameterOptimization", "3.3.8.$WCREV$")]
    29   [PluginFile("HeuristicLab.Problems.ParameterOptimization-3.3.dll", PluginFileType.Assembly)]
    30   [PluginDependency("HeuristicLab.Collections", "3.3")]
     28  [Plugin("HeuristicLab.Problems.Orienteering", "3.3.7.$WCREV$")]
     29  [PluginFile("HeuristicLab.Problems.Orienteering-3.3.dll", PluginFileType.Assembly)]
    3130  [PluginDependency("HeuristicLab.Common", "3.3")]
    3231  [PluginDependency("HeuristicLab.Core", "3.3")]
    33   [PluginDependency("HeuristicLab.Data", "3.3")]
    34   [PluginDependency("HeuristicLab.Encodings.RealVectorEncoding", "3.3")]
    35   [PluginDependency("HeuristicLab.Operators", "3.3")]
    36   [PluginDependency("HeuristicLab.Optimization", "3.3")]
    37   [PluginDependency("HeuristicLab.Parameters", "3.3")]
    38   [PluginDependency("HeuristicLab.Persistence", "3.3")]
     32  [PluginDependency("HeuristicLab.Random", "3.3")]
     33  [PluginDependency("HeuristicLab.Scripting", "3.3")]
    3934  public class HeuristicLabProblemsParameterOptimizationPlugin : PluginBase {    }
    4035}
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Scripting/3.3/CSharpScript.cs

    r11058 r11136  
    3838      get {
    3939        return @"// use 'vars' to access variables in the script's variable store (e.g. vars.x = 5)
     40// use 'vars[string]' to access variables via runtime strings (e.g. vars[""x""] = 5)
    4041// use 'vars.Contains(string)' to check if a variable exists
    4142// use 'vars.Clear()' to remove all variables
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Scripting/3.3/Variables.cs

    r10727 r11136  
    2020    }
    2121
     22    public object this[string key] {
     23      get { return variableStore[key]; }
     24      set { variableStore[key] = value; }
     25    }
     26
    2227    public bool Contains(string variableName) {
    2328      return variableStore.ContainsKey(variableName);
Note: See TracChangeset for help on using the changeset viewer.