simopt.solvers.randomsearch

Random Search Solver.

Randomly sample solutions from the feasible region. Can handle stochastic constraints. A detailed description of the solver can be found here.

Module Contents

class simopt.solvers.randomsearch.RandomSearchConfig

Bases: simopt.base.SolverConfig

Configuration for Random Search solver.

sample_size: Annotated[int, Field(default=10, gt=0, description='sample size per solution')]
class simopt.solvers.randomsearch.RandomSearch(name: str = '', fixed_factors: dict | None = None)

Bases: simopt.base.Solver

Random Search Solver.

A solver that randomly samples solutions from the feasible region. Take a fixed number of replications at each solution.

Initialize a solver object.

Parameters:
  • name (str, optional) – Name of the solver. Defaults to an empty string.

  • fixed_factors (dict | None, optional) – Dictionary of user-specified solver factors. Defaults to None.

name: str = 'RNDSRCH'
config_class: ClassVar[type[simopt.base.SolverConfig]]

Configuration class for the solver.

class_name_abbr: ClassVar[str] = 'RNDSRCH'

Short name of the solver class.

class_name: ClassVar[str] = 'Random Search'

Long name of the solver class.

objective_type: ClassVar[simopt.base.ObjectiveType]

Description of objective types.

constraint_type: ClassVar[simopt.base.ConstraintType]

Description of constraint types.

variable_type: ClassVar[simopt.base.VariableType]

Description of variable types.

gradient_needed: ClassVar[bool] = False

True if gradient of objective function is needed, otherwise False.

solve(problem: simopt.base.Problem) None

Run a single macroreplication of a solver on a problem.

Parameters:

problem (Problem) – Simulation-optimization problem to solve.

Returns:

  • list [Solution]: List of solutions recommended throughout the budget.

  • list [int]: List of intermediate budgets when recommended solutions

    change.

Return type:

tuple