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.
Ported six peaks bug from GKHayes
- Loading branch information
Showing
5 changed files
with
27 additions
and
5 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
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
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
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,17 @@ | ||
""" Classes for defining optimization problem objects.""" | ||
|
||
# Author: Andrew Rollings | ||
# License: BSD 3 clause | ||
|
||
import numpy as np | ||
|
||
from mlrose_hiive import DiscreteOpt, ContinuousPeaks | ||
|
||
|
||
class ContinuousPeaksGenerator: | ||
@staticmethod | ||
def generate(seed, size=20, t_pct=0.1): | ||
np.random.seed(seed) | ||
fitness = ContinuousPeaks(t_pct=t_pct) | ||
problem = DiscreteOpt(length=size, fitness_fn=fitness) | ||
return problem |
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