Changeset 4619 for trunk/sources/HeuristicLab.Problems.VehicleRouting.Views/3.3/VehicleRoutingProblemView.cs
- Timestamp:
- 10/19/10 13:22:55 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting.Views/3.3/VehicleRoutingProblemView.cs
r4352 r4619 26 26 using HeuristicLab.Core.Views; 27 27 using HeuristicLab.Core; 28 using HeuristicLab.Data; 29 using HeuristicLab.Parameters; 28 30 29 31 namespace HeuristicLab.Problems.VehicleRouting.Views { … … 42 44 protected override void DeregisterContentEvents() { 43 45 Content.CoordinatesParameter.ValueChanged -= new EventHandler(CoordinatesParameter_ValueChanged); 46 Content.BestKnownQualityParameter.ValueChanged -= new EventHandler(BestKnownQualityParameter_ValueChanged); 44 47 base.DeregisterContentEvents(); 45 48 } … … 47 50 base.RegisterContentEvents(); 48 51 Content.CoordinatesParameter.ValueChanged += new EventHandler(CoordinatesParameter_ValueChanged); 52 Content.BestKnownQualityParameter.ValueChanged += new EventHandler(BestKnownQualityParameter_ValueChanged); 49 53 } 50 54 … … 56 60 } else { 57 61 parameterCollectionView.Content = ((IParameterizedNamedItem)Content).Parameters; 58 vrpSolutionView.Content = new VRPSolution(Content.Coordinates);62 UpdateSolution(); 59 63 } 60 64 } … … 64 68 parameterCollectionView.Enabled = Content != null; 65 69 vrpSolutionView.Enabled = Content != null; 66 importB utton.Enabled = importButton2.Enabled = importButton3.Enabled = Content != null && !ReadOnly;70 importBestButton.Enabled = importButton.Enabled = importButton2.Enabled = importButton3.Enabled = Content != null && !ReadOnly; 67 71 } 68 72 … … 85 89 } 86 90 91 private void importBestButton_Click(object sender, EventArgs e) { 92 OpenFileDialog dialog = new OpenFileDialog(); 93 dialog.Filter = "VRP solution files (*.opt)|*.opt"; 94 95 if (dialog.ShowDialog() == DialogResult.OK) { 96 Content.ImportSolution(dialog.FileName); 97 } 98 } 99 87 100 private void importButton3_Click(object sender, EventArgs e) { 88 101 OpenFileDialog dialog = new OpenFileDialog(); … … 96 109 private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) { 97 110 vrpSolutionView.Content.Coordinates = Content.Coordinates; 98 } 111 } 112 113 private void UpdateSolution() { 114 if (Content.BestKnownSolution == null) 115 vrpSolutionView.Content = new VRPSolution(Content.Coordinates); 116 else { 117 //call evaluator 118 IValueLookupParameter<DoubleMatrix> distMatrix = new ValueLookupParameter<DoubleMatrix>("DistMatrix", 119 Content.DistanceMatrix); 120 121 TourEvaluation eval = VRPEvaluator.Evaluate( 122 Content.BestKnownSolution, 123 Content.Vehicles, 124 Content.DueTime, 125 Content.ServiceTime, 126 Content.ReadyTime, 127 Content.Demand, 128 Content.Capacity, 129 Content.FleetUsageFactorParameter.Value, 130 Content.TimeFactorParameter.Value, 131 Content.DistanceFactorParameter.Value, 132 Content.OverloadPenaltyParameter.Value, 133 Content.TardinessPenaltyParameter.Value, 134 Content.Coordinates, 135 distMatrix, 136 Content.UseDistanceMatrix); 137 138 Content.DistanceMatrix = distMatrix.Value; 139 140 vrpSolutionView.Content = new VRPSolution(Content.Coordinates, 141 Content.BestKnownSolution, 142 new DoubleValue(eval.Quality), 143 new DoubleValue(eval.Distance), 144 new DoubleValue(eval.Overload), 145 new DoubleValue(eval.Tardiness), 146 new DoubleValue(eval.TravelTime), 147 new DoubleValue(eval.VehcilesUtilized), 148 Content.DistanceMatrix, 149 Content.UseDistanceMatrix, 150 Content.ReadyTime, 151 Content.DueTime, 152 Content.ServiceTime); 153 } 154 } 155 156 void BestKnownQualityParameter_ValueChanged(object sender, EventArgs e) { 157 UpdateSolution(); 158 } 99 159 } 100 160 }
Note: See TracChangeset
for help on using the changeset viewer.