Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/23/10 01:48:44 (14 years ago)
Author:
abeham
Message:

fixed algorithm when neighborhood contains only tabu moves. It will now terminate correctly. #840

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSelector.cs

    r3140 r3195  
    7272      get { return (IValueLookupParameter<BoolValue>)Parameters["CopySelected"]; }
    7373    }
     74    public ILookupParameter<BoolValue> EmptyNeighborhoodParameter {
     75      get { return (ILookupParameter<BoolValue>)Parameters["EmptyNeighborhood"]; }
     76    }
    7477
    7578    public BoolValue CopySelected {
     
    9093      Parameters.Add(new SubScopesLookupParameter<BoolValue>("MoveTabu", "The tabu status of the move."));
    9194      Parameters.Add(new ValueLookupParameter<BoolValue>("CopySelected", "True if the selected move should be copied.", new BoolValue(false)));
     95      Parameters.Add(new LookupParameter<BoolValue>("EmptyNeighborhood", "Will be set to true if the neighborhood didn't contain any non-tabu moves. It is not set to false."));
    9296    }
    9397
     
    120124      }
    121125
    122       if (selected[0] == null) throw new InvalidOperationException("TabuSelector: The neighborhood contained no or too little moves that are not tabu.");
     126      if (selected[0] == null) {
     127        EmptyNeighborhoodParameter.ActualValue = new BoolValue(true);
     128        selected[0] = new Scope("All moves are tabu.");
     129      }
    123130
    124131      // remove from last to first so that the stored indices remain the same
Note: See TracChangeset for help on using the changeset viewer.