StochasticHillClimber

open class StochasticHillClimber @JvmOverloads constructor(problemDefinition: ProblemDefinition, evaluator: EvaluatorIfc, maxIterations: Int = defaultMaxNumberIterations, replicationsPerEvaluation: ReplicationPerEvaluationIfc, streamNum: Int = 0, streamProvider: RNStreamProviderIfc = KSLRandom.DefaultRNStreamProvider, name: String? = null) : StochasticSolver(source)

A class that implements the Stochastic Hill Climbing optimization algorithm. This algorithm searches for an optimal solution by iteratively evaluating and moving to neighborhood solutions, as determined by the evaluator and the problem definition. It uses a stochastic approach to explore the solution space by leveraging a random number stream.

Parameters

evaluator

An evaluator object that provides the problem definition and performs solution evaluation.

maxIterations

The maximum number of iterations the algorithm is allowed to execute.

replicationsPerEvaluation

An instance of ReplicationPerEvaluationIfc defining the strategy for determining the number of replications per evaluation.

streamNum

the random number stream number, defaults to 0, which means the next stream

streamProvider

the provider of random number streams, defaults to KSLRandom.DefaultRNStreamProvider

name

An optional name for this solver instance.

Constructors

Link copied to clipboard
constructor(problemDefinition: ProblemDefinition, evaluator: EvaluatorIfc, maxIterations: Int = defaultMaxNumberIterations, replicationsPerEvaluation: ReplicationPerEvaluationIfc, streamNum: Int = 0, streamProvider: RNStreamProviderIfc = KSLRandom.DefaultRNStreamProvider, name: String? = null)

Creates a StochasticHillClimber instance with the provided evaluator, maximum iterations, replications per evaluation strategy, and an optional random number stream and name.

constructor(problemDefinition: ProblemDefinition, evaluator: EvaluatorIfc, maxIterations: Int = defaultMaxNumberIterations, replicationsPerEvaluation: Int = defaultReplicationsPerEvaluation, streamNum: Int = 0, streamProvider: RNStreamProviderIfc = KSLRandom.DefaultRNStreamProvider, name: String? = null)

Constructs an instance of StochasticHillClimber with specified parameters.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Used to check if the last set of solutions that were captured are the same.

Functions

Link copied to clipboard
protected open override fun initializeIterations()

The default implementation ensures that the initial point and solution are input-feasible (feasible with respect to input ranges and deterministic constraints).

Link copied to clipboard
protected open override fun isStoppingCriteriaSatisfied(): Boolean

Subclasses should implement this function to determine if the solver should continue running iterations. This will likely include some implementation of stopping criteria. This function should implement stopping criteria based on the quality of the solution. The number of iterations, compared to the maximum number of iterations, is automatically checked after each step in the iterative process. Unless overridden, this function returns false by default, which indicates that the solution quality criteria have not been satisfied. This will cause the solver to iterate through all iterations of the solution process up to the maximum number of iterations. Alternatively, the user can specify an instance of the SolutionQualityEvaluatorIfc interface to determine if the solution quality has been reached.

Link copied to clipboard
protected open override fun mainIteration()

Randomly generates the next point using nextPoint(). Evaluates the point and gets the solution. If the solution is better than the current solution, it becomes the current solution.