Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/20/17 15:41:27 (6 years ago)
Author:
abeham
Message:

#1614:

  • Implementing basic algorithm according to paper (rechecking all operators)
  • Checking implementation with paper
  • Improved speed of move generator
  • Improved speed of randomized solution creator
File:
1 edited

Legend:

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

    r15510 r15553  
    191191
    192192    public Evaluation Evaluate(IntegerVector assignment) {
    193       return EvaluateIntegerVector(assignment, Demands, Capacities,
     193      var evaluation = EvaluateIntegerVector(assignment, Demands, Capacities,
    194194        InstallationCosts, Weights, Distances);
     195      return evaluation;
    195196    }
    196197
     
    217218    }
    218219
     220    public GQAPSolution ToEvaluatedSolution(IntegerVector assignment) {
     221      var evaluation = EvaluateIntegerVector(assignment, Demands, Capacities,
     222InstallationCosts, Weights, Distances);
     223      return new GQAPSolution(assignment, evaluation);
     224    }
     225
     226    public bool IsFeasible(IntegerVector assignment) {
     227      int len = assignment.Length;
     228      var utilization = new double[Capacities.Length];
     229      for (var equip = 0; equip < len; equip++) {
     230        var loc = assignment[equip];
     231        utilization[loc] += Demands[equip];
     232        if (utilization[loc] > Capacities[loc])
     233          return false;
     234      }
     235      return true;
     236    }
     237
    219238    public double ToSingleObjective(Evaluation fitness) {
    220239      return fitness.IsFeasible
Note: See TracChangeset for help on using the changeset viewer.