Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/06/12 04:29:56 (12 years ago)
Author:
abeham
Message:

#1614: restructured architecture to allow for different evaluator with different penalty strategies

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/SolutionCreators/SlackMinimizationSolutionCreator.cs

    r7813 r7970  
    3535  [Item("SlackMinimizationSolutionCreator", "A heuristic that creates a solution to the Generalized Quadratic Assignment Problem by minimizing the amount of slack.")]
    3636  [StorableClass]
    37   public class SlackMinimizationSolutionCreator : GQAPStochasticSolutionCreator {
     37  public class SlackMinimizationSolutionCreator : GQAPStochasticSolutionCreator,
     38    IEvaluatorAwareGQAPOperator {
    3839
    3940    public IValueLookupParameter<IntValue> MaximumTriesParameter {
     
    4950      get { return (IValueLookupParameter<IntValue>)Parameters["RandomWalkLength"]; }
    5051    }
     52    public IValueLookupParameter<IGQAPEvaluator> EvaluatorParameter {
     53      get { return (IValueLookupParameter<IGQAPEvaluator>)Parameters["Evaluator"]; }
     54    }
    5155
    5256    [StorableConstructor]
     
    5963      Parameters.Add(new ValueLookupParameter<IntValue>("Depth", "How deep the algorithm should look forward.", new IntValue(3)));
    6064      Parameters.Add(new ValueLookupParameter<IntValue>("RandomWalkLength", "The length of the random walk in the feasible region that is used to diversify the found assignments.", new IntValue(10)));
     65      Parameters.Add(new ValueLookupParameter<IGQAPEvaluator>("Evaluator", "The evaluator that is used to evaluate GQAP solutions."));
    6166    }
    6267
     
    7580    }
    7681
    77     public static IntegerVector CreateSolution(IRandom random, DoubleArray demands, DoubleArray capacities, int depth, int maximumTries, bool createMostFeasibleSolution, int randomWalkLength, CancellationToken cancel) {
     82    public static IntegerVector CreateSolution(IRandom random, DoubleArray demands,
     83      DoubleArray capacities, IGQAPEvaluator evaluator,
     84      int depth, int maximumTries, bool createMostFeasibleSolution, int randomWalkLength, CancellationToken cancel) {
    7885      IntegerVector result = null;
    7986      bool isFeasible = false;
     
    118125          }
    119126        } else RandomFeasibleWalk(random, assignment, demands, slack, randomWalkLength);
    120         double violation = GQAPEvaluator.EvaluateOverbooking(slack, capacities);
     127        double violation = evaluator.EvaluateOverbooking(slack, capacities);
    121128        isFeasible = violation == 0;
    122129        if (isFeasible || violation < minViolation) {
     
    177184    protected override IntegerVector CreateRandomSolution(IRandom random, DoubleArray demands, DoubleArray capacities) {
    178185      return CreateSolution(random, demands, capacities,
     186        EvaluatorParameter.ActualValue,
    179187        DepthParameter.ActualValue.Value,
    180188        MaximumTriesParameter.ActualValue.Value,
Note: See TracChangeset for help on using the changeset viewer.