Skip to content

Commit c242d4f

Browse files
committed
cleanup of jssp experiment
1 parent b8a57cb commit c242d4f

File tree

1 file changed

+7
-35
lines changed

1 file changed

+7
-35
lines changed

moptipy/examples/jssp/experiment.py

+7-35
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
from moptipy.algorithms.single_random_sample import SingleRandomSample
1414
from moptipy.algorithms.so.ea import EA
1515
from moptipy.algorithms.so.fitnesses.direct import Direct
16-
from moptipy.algorithms.so.fitnesses.rank import Rank
1716
from moptipy.algorithms.so.general_ea import GeneralEA
18-
from moptipy.algorithms.so.greedy_2plus1_ea_mod import GreedyTwoPlusOneEAmod
1917
from moptipy.algorithms.so.hill_climber import HillClimber
2018
from moptipy.algorithms.so.hill_climber_with_restarts import \
2119
HillClimberWithRestarts
@@ -95,27 +93,13 @@
9593
lambda inst, pwr, mm=mu, ll=lambda_: EA(
9694
Op0Shuffle(pwr), Op1Swap2(), None, mm, ll, 0.0)))
9795

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)))
119103

120104
for mu_lambda in [3, 4, 32]:
121105
DEFAULT_ALGORITHMS.append(cast(
@@ -168,18 +152,6 @@
168152
Op2GeneralizedAlternatingPosition(pwr), ml, ml, 0.05,
169153
fitness=Direct(), survival=FitnessProportionateSUS(),
170154
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))))
183155

184156

185157
def run_experiment(base_dir: str = pp.join(".", "results"),

0 commit comments

Comments
 (0)