Changeset 11316


Ignore:
Timestamp:
08/27/14 14:08:56 (5 years ago)
Author:
pfleck
Message:

#2208

  • Changed Coordinates to OptionalValueParameter so that distance matrix-only instances can be executed (but not visualized).
  • Updated VNS-OP sample.
Location:
branches/HeuristicLab.Problems.Orienteering
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/OrienteeringProblem.cs

    r11314 r11316  
    4545
    4646    #region Parameter Properties
    47     public ValueParameter<DoubleMatrix> CoordinatesParameter {
    48       get { return (ValueParameter<DoubleMatrix>)Parameters["Coordinates"]; }
     47    public OptionalValueParameter<DoubleMatrix> CoordinatesParameter {
     48      get { return (OptionalValueParameter<DoubleMatrix>)Parameters["Coordinates"]; }
    4949    }
    5050    public ValueParameter<DistanceMatrix> DistanceMatrixParameter {
     
    124124    public OrienteeringProblem()
    125125      : base(new OrienteeringEvaluator(), new GreedyOrienteeringTourCreator()) {
    126       Parameters.Add(new ValueParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the points."));
     126      Parameters.Add(new OptionalValueParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the points."));
    127127      Parameters.Add(new ValueParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the points."));
    128128      Parameters.Add(new ValueParameter<IntValue>("StartingPoint", "Index of the starting point.", new IntValue(0)));
     
    301301    }
    302302    private void UpdateDistanceMatrix() {
     303      if (Coordinates == null) {
     304        DistanceMatrix = new DistanceMatrix(0, 0);
     305        return;
     306      }
     307
    303308      var coordinates = Coordinates;
    304309      int dimension = coordinates.Rows;
Note: See TracChangeset for help on using the changeset viewer.