Changeset 7970 for branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/SolutionCreators/SlackMinimizationSolutionCreator.cs
- Timestamp:
- 06/06/12 04:29:56 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/SolutionCreators/SlackMinimizationSolutionCreator.cs
r7813 r7970 35 35 [Item("SlackMinimizationSolutionCreator", "A heuristic that creates a solution to the Generalized Quadratic Assignment Problem by minimizing the amount of slack.")] 36 36 [StorableClass] 37 public class SlackMinimizationSolutionCreator : GQAPStochasticSolutionCreator { 37 public class SlackMinimizationSolutionCreator : GQAPStochasticSolutionCreator, 38 IEvaluatorAwareGQAPOperator { 38 39 39 40 public IValueLookupParameter<IntValue> MaximumTriesParameter { … … 49 50 get { return (IValueLookupParameter<IntValue>)Parameters["RandomWalkLength"]; } 50 51 } 52 public IValueLookupParameter<IGQAPEvaluator> EvaluatorParameter { 53 get { return (IValueLookupParameter<IGQAPEvaluator>)Parameters["Evaluator"]; } 54 } 51 55 52 56 [StorableConstructor] … … 59 63 Parameters.Add(new ValueLookupParameter<IntValue>("Depth", "How deep the algorithm should look forward.", new IntValue(3))); 60 64 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.")); 61 66 } 62 67 … … 75 80 } 76 81 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) { 78 85 IntegerVector result = null; 79 86 bool isFeasible = false; … … 118 125 } 119 126 } else RandomFeasibleWalk(random, assignment, demands, slack, randomWalkLength); 120 double violation = GQAPEvaluator.EvaluateOverbooking(slack, capacities);127 double violation = evaluator.EvaluateOverbooking(slack, capacities); 121 128 isFeasible = violation == 0; 122 129 if (isFeasible || violation < minViolation) { … … 177 184 protected override IntegerVector CreateRandomSolution(IRandom random, DoubleArray demands, DoubleArray capacities) { 178 185 return CreateSolution(random, demands, capacities, 186 EvaluatorParameter.ActualValue, 179 187 DepthParameter.ActualValue.Value, 180 188 MaximumTriesParameter.ActualValue.Value,
Note: See TracChangeset
for help on using the changeset viewer.