Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/04/20 07:06:39 (4 years ago)
Author:
abeham
Message:

#2521: working on VRP

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Moves/VRPMoveEvaluator.cs

    r17698 r17712  
    2020#endregion
    2121
     22using HEAL.Attic;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    2526using HeuristicLab.Optimization;
    2627using HeuristicLab.Parameters;
    27 using HEAL.Attic;
    2828using HeuristicLab.Problems.VehicleRouting.Interfaces;
     29using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
    2930
    3031namespace HeuristicLab.Problems.VehicleRouting.Encodings.General {
     
    4344      get { return (ILookupParameter<DoubleValue>)Parameters["MovePenalty"]; }
    4445    }
     46    public ILookupParameter<VRPEvaluation> MoveEvaluationResultParameter {
     47      get { return (ILookupParameter<VRPEvaluation>)Parameters["MoveEvaluationResult"]; }
     48    }
    4549
    4650    [StorableConstructor]
     
    5256      Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The relative quality of the move."));
    5357      Parameters.Add(new LookupParameter<DoubleValue>("MovePenalty", "The penalty applied to the move."));
     58      Parameters.Add(new LookupParameter<VRPEvaluation>("MoveEvaluationResult", "The evaluation result of the move."));
    5459    }
    5560
     
    6065    //helper method to evaluate an updated individual
    6166    protected void UpdateEvaluation(IVRPEncodedSolution updatedTours) {
    62       IVRPEvaluator evaluator = ProblemInstance.MoveEvaluator;
    63 
    64       try {
    65         this.ExecutionContext.Scope.Variables.Add(new Variable(evaluator.VRPToursParameter.ActualName,
    66           updatedTours));
    67 
    68         IAtomicOperation op = this.ExecutionContext.CreateChildOperation(evaluator);
    69         op.Operator.Execute((IExecutionContext)op, CancellationToken);
    70       }
    71       finally {
    72         this.ExecutionContext.Scope.Variables.Remove(evaluator.VRPToursParameter.ActualName);
    73       }
     67      var evaluation = ProblemInstance.Evaluate(updatedTours);
     68      MoveEvaluationResultParameter.ActualValue = evaluation;
     69      MoveQualityParameter.ActualValue = new DoubleValue(evaluation.Quality);
     70      MovePenaltyParameter.ActualValue = new DoubleValue(evaluation.Penalty);
    7471    }
    7572
Note: See TracChangeset for help on using the changeset viewer.