Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1791 for trunk/sources


Ignore:
Timestamp:
05/13/09 20:55:58 (15 years ago)
Author:
abeham
Message:

removed annoying quit after x tries

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.SimOpt/3.2/SimOptSelfAdaptiveNumericVectorNormalMutation.cs

    r1530 r1791  
    4848
    4949      ConstrainedItemList parameters = GetVariableValue<ConstrainedItemList>("Items", scope, false);
    50       int tries;
    5150      ConstrainedItemList temp = null;
    5251      ICollection<IConstraint> tmp;
     
    5453      NormalDistributedRandom nd = new NormalDistributedRandom(random, 0.0, 1.0);
    5554
    56       for (tries = 0; tries < 10000; tries++) {
     55      do {
    5756        temp = (ConstrainedItemList)parameters.Clone();
    5857
     
    7372          }
    7473        }
    75         if (temp.EndCombinedOperation(out tmp)) break;
    76       }
     74      } while (!temp.EndCombinedOperation(out tmp));
    7775
    78       if (tries < 10000) {
    79         parameters.BeginCombinedOperation();
    80         for (int i = 0; i < temp.Count; i++)
    81           parameters.TrySetAt(i, temp[i], out tmp);
    82         parameters.EndCombinedOperation(out tmp);
    83       } else throw new InvalidOperationException("ERROR in SimOptSelfAdaptiveNumericVectorProbabilityMutation: no feasible result in 10000 tries");
     76      parameters.BeginCombinedOperation();
     77      for (int i = 0; i < temp.Count; i++)
     78        parameters.TrySetAt(i, temp[i], out tmp);
     79      parameters.EndCombinedOperation(out tmp);
    8480
    8581      return null;
Note: See TracChangeset for help on using the changeset viewer.