Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6947 for branches


Ignore:
Timestamp:
11/04/11 11:44:37 (13 years ago)
Author:
svonolfe
Message:

Fixed small issues in view and crossover (#1177)

Location:
branches/VRP
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/MDCVRPPDTWView.cs

    r6856 r6947  
    170170          } else {
    171171            {
    172               Point[] locationPoints = new Point[coordinates.Rows];
     172              Point[] locationPoints = new Point[cities];
    173173              //just draw customers
    174               for (int i = 1; i < coordinates.Rows; i++) {
    175                 locationPoints[i] = new Point(border + ((int)((coordinates[i, 0] - xMin) * xStep)),
    176                                 bitmap.Height - (border + ((int)((coordinates[i, 1] - yMin) * yStep))));
     174              for (int i = 0; i < cities; i++) {
     175                locationPoints[i] = new Point(border + ((int)((Content.GetCoordinates(i + 1)[0] - xMin) * xStep)),
     176                                bitmap.Height - (border + ((int)((Content.GetCoordinates(i + 1)[1] - yMin) * yStep))));
    177177
    178178                graphics.FillRectangle(Brushes.Black, locationPoints[i].X - 3, locationPoints[i].Y - 3, 6, 6);
     
    182182                for (int i = 0; i < cities; i++) {
    183183                  if (demand[i] < 0) {
    184                     graphics.DrawLine(flowPen, locationPoints[pickupDeliveryLocation[i]], locationPoints[i + 1]);
     184                    graphics.DrawLine(flowPen, locationPoints[pickupDeliveryLocation[i] - 1], locationPoints[i]);
    185185                  }
    186186                }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinInsertionBasedCrossover.cs

    r6851 r6947  
    205205
    206206      int length = Math.Min(Length.Value.Value, parent1.Tours.Count) + 1;
    207       int k = random.Next(1, length);
     207      int k = 1;
     208      if(length > 1)
     209        k = random.Next(1, length);
    208210      for (int i = 0; i < k; i++) {
    209211        int index = SelectRandomTourBiasedByLength(random, p1Clone);
     
    227229
    228230        //DESTROY - remove cities from r1
    229         int removed = random.Next(1, r1.Stops.Count + 1);
     231        int removed = 1;
     232        if(r1.Stops.Count > 1)
     233          removed = random.Next(1, r1.Stops.Count + 1);
    230234        for (int i = 0; i < removed; i++) {
    231235          childTour.Stops.RemoveAt(SelectCityBiasedByNeighborDistance(random, childTour, child));
Note: See TracChangeset for help on using the changeset viewer.