forked from gkhayes/mlrose
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c23243b
commit bc81f8e
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
""" Classes for defining optimization problem objects.""" | ||
|
||
import numpy as np | ||
|
||
from mlrose_hiive import DiscreteOpt, FourPeaks | ||
|
||
|
||
class FourPeaksGenerator: | ||
"""Generator class for Four Peaks.""" | ||
@staticmethod | ||
def generate(seed, size=20, t_pct=0.1): | ||
np.random.seed(seed) | ||
fitness = FourPeaks(t_pct=t_pct) | ||
problem = DiscreteOpt(length=size, fitness_fn=fitness) | ||
return problem |