Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/28/11 14:16:21 (13 years ago)
Author:
svonolfe
Message:

Merged changes from trunk (#1561) into branch (#1177)

Location:
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinManipulator.cs

    r4752 r6607  
    3838    }
    3939
     40    public IValueParameter<BoolValue> AllowInfeasibleSolutions {
     41      get { return (IValueParameter<BoolValue>)Parameters["AllowInfeasibleSolutions"]; }
     42    }
     43
    4044    [StorableConstructor]
    4145    protected PotvinManipulator(bool deserializing) : base(deserializing) { }
     
    4347    public PotvinManipulator() {
    4448      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
     49      Parameters.Add(new ValueParameter<BoolValue>("AllowInfeasibleSolutions", "Indicates if infeasible solutions should be allowed.", new BoolValue(false)));
    4550    }
    4651
     
    7883    }
    7984
    80     protected bool FindInsertionPlace(PotvinEncoding individual, int city, int routeToAvoid, out int route, out int place) {
     85    protected bool FindInsertionPlace(PotvinEncoding individual, int city, int routeToAvoid, bool allowInfeasible, out int route, out int place) {
    8186      return individual.FindInsertionPlace(
    82         city, routeToAvoid, out route, out place);
     87        city, routeToAvoid, allowInfeasible, out route, out place);
    8388    }
    8489   
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinOneLevelExchangeManipulator.cs

    r4752 r6607  
    4646   
    4747    protected override void Manipulate(IRandom random, PotvinEncoding individual) {
     48      bool allowInfeasible = AllowInfeasibleSolutions.Value.Value;
     49     
    4850      int selectedIndex = SelectRandomTourBiasedByLength(random, individual);
    4951      Tour route1 =
     
    5456        int insertedRoute, insertedPlace;
    5557
    56         if (FindInsertionPlace(individual, route1.Stops[i], selectedIndex, out insertedRoute, out insertedPlace)) {
     58        if (FindInsertionPlace(individual, route1.Stops[i], selectedIndex, allowInfeasible, out insertedRoute, out insertedPlace)) {
    5759          individual.Tours[insertedRoute].Stops.Insert(insertedPlace, route1.Stops[i]);
    5860          replaced.Add(route1.Stops[i]);
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinTwoLevelExchangeManipulator.cs

    r5867 r6607  
    4646
    4747    protected override void Manipulate(IRandom random, PotvinEncoding individual) {
     48      bool allowInfeasible = AllowInfeasibleSolutions.Value.Value;
     49     
    4850      int selectedIndex = SelectRandomTourBiasedByLength(random, individual);
    4951      Tour route1 = individual.Tours[selectedIndex];
     
    6567                int routeIdx, place;
    6668                if (FindInsertionPlace(individual,
    67                   customer2, selectedIndex, out routeIdx, out place)) {
     69                  customer2, selectedIndex, allowInfeasible, out routeIdx, out place)) {
    6870                  individual.Tours[routeIdx].Stops.Insert(place, customer2);
    6971                  route1.Stops.RemoveAt(customer1Position);
Note: See TracChangeset for help on using the changeset viewer.