Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/25/10 13:50:51 (14 years ago)
Author:
svonolfe
Message:

Added ORLIBParser (#1039)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/VehicleRoutingProblem.cs

    r4301 r4315  
    483483    }
    484484
     485    public void ImportFromORLib(string orFileName) {
     486      ORLIBParser parser = new ORLIBParser(orFileName);
     487      parser.Parse();
     488
     489      this.Name = parser.Name;
     490      int problemSize = parser.Demands.Length;
     491
     492      Coordinates = new DoubleMatrix(parser.Vertices);
     493      Vehicles.Value = problemSize - 1;
     494      Capacity.Value = parser.Capacity;
     495      Demand = new DoubleArray(parser.Demands);
     496      ReadyTime = new DoubleArray(problemSize);
     497      DueTime = new DoubleArray(problemSize);
     498      ServiceTime = new DoubleArray(problemSize);
     499
     500      ReadyTime[0] = 0;
     501      DueTime[0] = parser.MaxRouteTime;
     502      ServiceTime[0] = 0;
     503
     504      for (int i = 1; i < problemSize; i++) {
     505        ReadyTime[i] = 0;
     506        DueTime[i] = int.MaxValue;
     507        ServiceTime[i] = parser.ServiceTime;
     508      }
     509
     510      OnReset();
     511    }
     512
    485513    private void InitializeRandomVRPInstance() {
    486514      System.Random rand = new System.Random();
Note: See TracChangeset for help on using the changeset viewer.