Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/25/12 18:32:44 (12 years ago)
Author:
abeham
Message:

#1614: worked on GQAP and GRASP+PR

Location:
branches/GeneralizedQAP
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP

    • Property svn:ignore
      •  

        old new  
        11*.suo
         2TestResults
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/StochasticNMoveSingleMoveGenerator.cs

    r7407 r7412  
    5454    }
    5555
    56     public static NMove Generate(IRandom random, IntegerVector assignment, int n, DoubleArray capacities) {
    57       int moving = random.Next(n) + 1;
    58       int[] equipments = new int[moving], locations = new int[moving];
     56    public static NMove GenerateUpToN(IRandom random, IntegerVector assignment, int n, DoubleArray capacities) {
     57      return GenerateExactlyN(random, assignment, random.Next(n) + 1, capacities);
     58    }
     59
     60    public static NMove GenerateExactlyN(IRandom random, IntegerVector assignment, int n, DoubleArray capacities) {
     61      int[] equipments = new int[n], locations = new int[n];
    5962      HashSet<int> chosenEquipments = new HashSet<int>();
    60       for (int i = 0; i < moving; i++) {
     63      for (int i = 0; i < n; i++) {
    6164        do {
    6265          equipments[i] = random.Next(assignment.Length);
     
    7174
    7275    public override IEnumerable<NMove> GenerateMoves(IntegerVector assignment, int n) {
    73       yield return Generate(RandomParameter.ActualValue, assignment, n, CapacitiesParameter.ActualValue);
     76      yield return GenerateUpToN(RandomParameter.ActualValue, assignment, n, CapacitiesParameter.ActualValue);
    7477    }
    7578  }
Note: See TracChangeset for help on using the changeset viewer.