Changeset 11189


Ignore:
Timestamp:
07/14/14 15:27:11 (8 years ago)
Author:
pfleck
Message:

#2208

  • Implemented OrienteeringProblem as CVRPData ProblemInstanceInterpreter.
  • Added OrienteeringProblemView.
Location:
branches/HeuristicLab.Problems.Orienteering
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering.Views/3.3/HeuristicLab.Problems.Orienteering.Views-3.3.csproj

    r11188 r11189  
    3939    <Reference Include="System" />
    4040    <Reference Include="System.Core" />
     41    <Reference Include="System.Data" />
     42    <Reference Include="System.Drawing" />
     43    <Reference Include="System.Windows.Forms" />
     44    <Reference Include="System.Xml" />
    4145  </ItemGroup>
    4246  <ItemGroup>
     47    <Compile Include="OrienteeringProblemView.cs">
     48      <SubType>UserControl</SubType>
     49    </Compile>
     50    <Compile Include="OrienteeringProblemView.Designer.cs">
     51      <DependentUpon>OrienteeringProblemView.cs</DependentUpon>
     52    </Compile>
    4353    <Compile Include="Plugin.cs" />
    4454    <Compile Include="Properties\AssemblyInfo.cs" />
     
    5060  </ItemGroup>
    5161  <ItemGroup>
     62    <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
     63      <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
     64      <Name>HeuristicLab.Common-3.3</Name>
     65    </ProjectReference>
     66    <ProjectReference Include="..\..\HeuristicLab.Core.Views\3.3\HeuristicLab.Core.Views-3.3.csproj">
     67      <Project>{E226881D-315F-423D-B419-A766FE0D8685}</Project>
     68      <Name>HeuristicLab.Core.Views-3.3</Name>
     69    </ProjectReference>
     70    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
     71      <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
     72      <Name>HeuristicLab.Core-3.3</Name>
     73    </ProjectReference>
     74    <ProjectReference Include="..\..\HeuristicLab.MainForm.WindowsForms\3.3\HeuristicLab.MainForm.WindowsForms-3.3.csproj">
     75      <Project>{AB687BBE-1BFE-476B-906D-44237135431D}</Project>
     76      <Name>HeuristicLab.MainForm.WindowsForms-3.3</Name>
     77    </ProjectReference>
     78    <ProjectReference Include="..\..\HeuristicLab.MainForm\3.3\HeuristicLab.MainForm-3.3.csproj">
     79      <Project>{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}</Project>
     80      <Name>HeuristicLab.MainForm-3.3</Name>
     81    </ProjectReference>
     82    <ProjectReference Include="..\..\HeuristicLab.Optimization.Views\3.3\HeuristicLab.Optimization.Views-3.3.csproj">
     83      <Project>{662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}</Project>
     84      <Name>HeuristicLab.Optimization.Views-3.3</Name>
     85    </ProjectReference>
     86    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
     87      <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
     88      <Name>HeuristicLab.Optimization-3.3</Name>
     89    </ProjectReference>
    5290    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
    5391      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
    5492      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
     93    </ProjectReference>
     94    <ProjectReference Include="..\..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj">
     95      <Project>{3540E29E-4793-49E7-8EE2-FEA7F61C3994}</Project>
     96      <Name>HeuristicLab.Problems.Instances-3.3</Name>
     97    </ProjectReference>
     98    <ProjectReference Include="..\..\HeuristicLab.Problems.Orienteering\3.3\HeuristicLab.Problems.Orienteering-3.3.csproj">
     99      <Project>{D1EFA4CC-909F-41D5-9C1F-C3AF1957A372}</Project>
     100      <Name>HeuristicLab.Problems.Orienteering-3.3</Name>
    55101    </ProjectReference>
    56102  </ItemGroup>
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/HeuristicLab.Problems.Orienteering-3.3.csproj

    r11187 r11189  
    106106      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
    107107    </ProjectReference>
     108    <ProjectReference Include="..\..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj">
     109      <Project>{3540E29E-4793-49E7-8EE2-FEA7F61C3994}</Project>
     110      <Name>HeuristicLab.Problems.Instances-3.3</Name>
     111    </ProjectReference>
    108112    <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">
    109113      <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project>
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/OrienteeringProblem.cs

    r11187 r11189  
    2828using HeuristicLab.Parameters;
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     30using HeuristicLab.Problems.Instances;
    3031
    3132namespace HeuristicLab.Problems.Orienteering {
     
    3637  public class OrienteeringProblem
    3738    : SingleObjectiveHeuristicOptimizationProblem<IOrienteeringEvaluator, IIntegerVectorCreator>,
    38     IStorableContent {
     39    IStorableContent, IProblemInstanceConsumer<CVRPData> {
    3940
    4041    public string Filename { get; set; }
     
    8586      set { UseDistanceMatrixParameter.Value = value; }
    8687    }
     88    public IntValue StartingPoint {
     89      get { return StartingPointParameter.Value; }
     90      set { StartingPointParameter.Value = value; }
     91    }
     92    public IntValue TerminusPoint {
     93      get { return TerminusPointParameter.Value; }
     94      set { TerminusPointParameter.Value = value; }
     95    }
    8796    public DoubleValue MaximumDistance {
    8897      get { return MaximumDistanceParameter.Value; }
     
    93102      set { ScoresParameter.Value = value; }
    94103    }
     104    public DoubleValue FixedPenalty {
     105      get { return FixedPenaltyParameter.Value; }
     106      set { FixedPenaltyParameter.Value = value; }
     107    }
    95108    public IntegerVector BestKnownSolution {
    96109      get { return BestKnownSolutionParameter.Value; }
     
    115128
    116129    public OrienteeringProblem()
    117       : base(new OrienteeringEvaluator(), new UniformRandomIntegerVectorCreator()) {
     130      : base(new OrienteeringEvaluator(), new UniformRandomIntegerVectorCreator()) { // TODO: Greedy route creator for solution creator
    118131      Parameters.Add(new OptionalValueParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the points."));
    119132      Parameters.Add(new OptionalValueParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the points."));
     
    197210      // TODO
    198211    }
     212
     213    public void Load(CVRPData data) {
     214      if (data.Coordinates == null && data.Distances == null)
     215        throw new System.IO.InvalidDataException("The given instance specifies neither coordinates nor distances!");
     216      if (data.Coordinates != null && data.Coordinates.GetLength(1) != 2)
     217        throw new System.IO.InvalidDataException("The coordinates of the given instance are not in the right format, there need to be one row for each customer and two columns for the x and y coordinates.");
     218
     219      Name = data.Name;
     220      Description = data.Description;
     221
     222      Coordinates = data.Coordinates != null ? new DoubleMatrix(data.Coordinates) : null;
     223      UseDistanceMatrix.Value = data.Distances != null;
     224      DistanceMatrix = data.Distances != null ? new DistanceMatrix(data.Distances) : null;
     225      StartingPoint = new IntValue(0);// Depot is interpreted as start and endpoint (default)
     226      TerminusPoint = new IntValue(0);
     227
     228      MaximumDistance = new DoubleValue(data.Capacity); // capacity is interpreted as max distance
     229      Scores = new DoubleArray(data.Demands); // demands are interpreted as scores
     230
     231      BestKnownQuality = null;
     232      BestKnownSolution = null;
     233    }
    199234  }
    200235}
Note: See TracChangeset for help on using the changeset viewer.