|
13 | 13 | from moptipy.algorithms.single_random_sample import SingleRandomSample
|
14 | 14 | from moptipy.algorithms.so.ea import EA
|
15 | 15 | from moptipy.algorithms.so.fitnesses.direct import Direct
|
16 |
| -from moptipy.algorithms.so.fitnesses.rank import Rank |
17 | 16 | from moptipy.algorithms.so.general_ea import GeneralEA
|
18 |
| -from moptipy.algorithms.so.greedy_2plus1_ea_mod import GreedyTwoPlusOneEAmod |
19 | 17 | from moptipy.algorithms.so.hill_climber import HillClimber
|
20 | 18 | from moptipy.algorithms.so.hill_climber_with_restarts import \
|
21 | 19 | HillClimberWithRestarts
|
|
95 | 93 | lambda inst, pwr, mm=mu, ll=lambda_: EA(
|
96 | 94 | Op0Shuffle(pwr), Op1Swap2(), None, mm, ll, 0.0)))
|
97 | 95 |
|
98 |
| - if 1 < mu < 32: |
99 |
| - brr = [0.0001, 0.0003, 0.001, 0.003, 0.01, 0.05, 0.25] \ |
100 |
| - if (mu == 2) and (lambda_ <= 3) else [0.01, 0.05, 0.25] |
101 |
| - for br in brr: |
102 |
| - DEFAULT_ALGORITHMS.append(cast( |
103 |
| - Callable[[Instance, Permutations], Algorithm], |
104 |
| - lambda inst, pwr, mm=mu, ll=lambda_, bb=br: EA( |
105 |
| - Op0Shuffle(pwr), Op1Swap2(), |
106 |
| - Op2GeneralizedAlternatingPosition(pwr), mm, ll, bb))) |
107 |
| - DEFAULT_ALGORITHMS.append(cast( |
108 |
| - Callable[[Instance, Permutations], Algorithm], |
109 |
| - lambda inst, pwr, mm=mu, ll=lambda_, bb=br: EA( |
110 |
| - Op0Shuffle(pwr), Op1Swap2(), |
111 |
| - Op2GeneralizedAlternatingPosition(pwr), mm, ll, bb))) |
112 |
| - |
113 |
| -DEFAULT_ALGORITHMS.append( |
114 |
| - lambda inst, pwr: GreedyTwoPlusOneEAmod( |
115 |
| - Op0Shuffle(pwr), Op1Swap2(), Op2GeneralizedAlternatingPosition(pwr))) |
116 |
| -DEFAULT_ALGORITHMS.append( |
117 |
| - lambda inst, pwr: GreedyTwoPlusOneEAmod( |
118 |
| - Op0Shuffle(pwr), Op1SwapN(), Op2GeneralizedAlternatingPosition(pwr))) |
| 96 | +for mu_lambda in [2, 4, 32]: |
| 97 | + for br_exp in range(1, 11): |
| 98 | + DEFAULT_ALGORITHMS.append(cast( |
| 99 | + Callable[[Instance, Permutations], Algorithm], |
| 100 | + lambda inst, pwr, ml=mu_lambda, br=(2 ** -br_exp): EA( |
| 101 | + Op0Shuffle(pwr), Op1Swap2(), |
| 102 | + Op2GeneralizedAlternatingPosition(pwr), ml, ml, br))) |
119 | 103 |
|
120 | 104 | for mu_lambda in [3, 4, 32]:
|
121 | 105 | DEFAULT_ALGORITHMS.append(cast(
|
|
168 | 152 | Op2GeneralizedAlternatingPosition(pwr), ml, ml, 0.05,
|
169 | 153 | fitness=Direct(), survival=FitnessProportionateSUS(),
|
170 | 154 | mating=Tournament(2))))
|
171 |
| - DEFAULT_ALGORITHMS.append(cast( |
172 |
| - Callable[[Instance, Permutations], Algorithm], |
173 |
| - lambda inst, pwr, ml=mu_lambda: GeneralEA( |
174 |
| - Op0Shuffle(pwr), Op1Swap2(), |
175 |
| - Op2GeneralizedAlternatingPosition(pwr), ml, ml, 0.05, |
176 |
| - fitness=Direct(), survival=FitnessProportionateSUS(0.01)))) |
177 |
| - DEFAULT_ALGORITHMS.append(cast( |
178 |
| - Callable[[Instance, Permutations], Algorithm], |
179 |
| - lambda inst, pwr, ml=mu_lambda: GeneralEA( |
180 |
| - Op0Shuffle(pwr), Op1Swap2(), |
181 |
| - Op2GeneralizedAlternatingPosition(pwr), ml, ml, 0.05, |
182 |
| - fitness=Rank(), survival=FitnessProportionateSUS(0.01)))) |
183 | 155 |
|
184 | 156 |
|
185 | 157 | def run_experiment(base_dir: str = pp.join(".", "results"),
|
|
0 commit comments