Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/31/10 14:51:43 (14 years ago)
Author:
svonolfe
Message:

Added a tour view for a VRP solution (#1039)

File:
1 edited

Legend:

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

    r4268 r4349  
    2828using HeuristicLab.Problems.VehicleRouting.Encodings;
    2929using HeuristicLab.Parameters;
     30using System.Linq;
    3031
    3132namespace HeuristicLab.Problems.VehicleRouting.Views {
     
    6869      } else {
    6970        GenerateImage();
    70         tourViewHost.Content = Content.Solution;
     71        UpdateTourView();
    7172      }
    7273    }
     
    8182      pictureBox.Enabled = Content != null;
    8283      tourGroupBox.Enabled = Content != null;
     84    }
     85
     86    private void UpdateTourView() {
     87      tourGridView.Rows.Clear();
     88      tourGridView.ColumnCount = Content.Coordinates.Rows - 1;
     89
     90      if (Content != null && Content.Solution != null) {
     91        foreach (Tour tour in Content.Solution.GetTours(new ValueLookupParameter<DoubleMatrix>("DistanceMatrix", Content.DistanceMatrix))) {
     92          int row = tourGridView.Rows.Add();
     93          int cell = 0;
     94          foreach (int city in tour.Cities) {
     95            tourGridView.Rows[row].Cells[cell].Value = city;
     96            cell++;
     97          }
     98        }
     99      }
    83100    }
    84101
     
    203220      else {
    204221        GenerateImage();
    205         tourViewHost.Content = Content.Solution;
     222        UpdateTourView();
    206223      }
    207224    }
Note: See TracChangeset for help on using the changeset viewer.