Skip to content

Commit

Permalink
create four peaks generator class
Browse files Browse the repository at this point in the history
  • Loading branch information
harrisonfloam committed Mar 27, 2024
1 parent c23243b commit bc81f8e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mlrose_hiive/generators/four_peaks_generator.py
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

0 comments on commit bc81f8e

Please sign in to comment.