simopt.models package

Submodules

simopt.models.amusementpark module

Summary

Simulate a single day of operation for an amusement park queuing problem. A detailed description of the model/problem can be found here.

class simopt.models.amusementpark.AmusementPark(fixed_factors=None)

Bases: Model

A model that simulates a single day of operation for an amusement park queuing problem based on a poisson distributed tourist arrival rate, a next attraction transition matrix, and attraction durations based on an Erlang distribution. Returns the total number and percent of tourists to leave the park due to full queues.

name

name of model

Type

str

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (dict) – fixed_factors of the simulation model

See also

base.Model

check_arrival_gammas()
check_depart_probabilities()
check_erlang_scale()
check_erlang_shape()
check_number_attractions()
check_park_capacity()
check_queue_capacities()
check_simulatable_factors()

Determine if a simulation replication can be run with the given factors.

Notes

Each subclass of base.Model has its own custom check_simulatable_factors method.

Returns

is_simulatable – True if model specified by factors is simulatable, otherwise False.

Return type

bool

check_time_open()
check_transition_probabilities()
replicate(rng_list)

Simulate a single replication for the current model factors.

Parameters

rng_list ([list] [rng.mrg32k3a.MRG32k3a]) – rngs for model to use when simulating a replication

Returns

responses – performance measures of interest “total_departed_tourists”: The total number of tourists to leave the park due

to full queues

”percent_departed_tourists”: The percentage of tourists to leave the park due

to full queues

Return type

dict

class simopt.models.amusementpark.AmusementParkMinDepart(name='AMUSEMENTPARK-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Class to make amusement park simulation-optimization problems.

name

name of problem

Type

str

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

str

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

str

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

base.Model

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

model_decision_factors

set of keys for factors that are decision variables

Type

set of str

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

[list] [rng.mrg32k3a.MRG32k3a]

factors
changeable factors of the problem
initial_solutiontuple

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name of problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dict) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (rng.mrg32k3a.MRG32k3a) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dict) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dict) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dict

simopt.models.chessmm module

Summary

Simulate matching of chess players on an online platform. A detailed description of the model/problem can be found here.

class simopt.models.chessmm.ChessAvgDifference(name='CHESS-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Base class to implement simulation-optimization problems.

name

name of problem

Type

string

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

string

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

string

lower_bounds

lower bound for each decision variable

Type

tuple

upper_bounds

upper bound for each decision variable

Type

tuple

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

Model object

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

list of mrg32k3a.mrg32k3a.MRG32k3a objects

factors
changeable factors of the problem
initial_solutionlist

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

prev_costlist

cost of prevention

upper_thresfloat > 0

upper limit of amount of contamination

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name for problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

check_upper_time()
deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dictionary) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a object) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dictionary

class simopt.models.chessmm.ChessMatchmaking(fixed_factors=None)

Bases: Model

A model that simulates a matchmaking problem with a Elo (truncated normal) distribution of players and Poisson arrivals. Returns the average difference between matched players.

name

name of model

Type

string

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI and data validation)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (nested dict) – fixed factors of the simulation model

See also

base.Model

check_allowable_diff()
check_elo_mean()
check_elo_sd()
check_num_players()
check_poisson_rate()
replicate(rng_list)

Simulate a single replication for the current model factors.

Parameters

rng_list (list of mrg32k3a.mrg32k3a.MRG32k3a objects) – rngs for model to use when simulating a replication

Returns

  • responses (dict) – performance measures of interest “avg_diff” = the average Elo difference between all pairs “avg_wait_time” = the average waiting time

  • gradients (dict of dicts) – gradient estimates for each response

simopt.models.cntnv module

Summary

Simulate a day’s worth of sales for a newsvendor. A detailed description of the model/problem can be found here.

class simopt.models.cntnv.CntNV(fixed_factors=None)

Bases: Model

A model that simulates a day’s worth of sales for a newsvendor with a Burr Type XII demand distribution. Returns the profit, after accounting for order costs and salvage.

name

name of model

Type

string

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (dict) – fixed_factors of the simulation model

See also

base.Model

check_Burr_c()
check_Burr_k()
check_order_quantity()
check_purchase_price()
check_sales_price()
check_salvage_price()
check_simulatable_factors()

Determine if a simulation replication can be run with the given factors.

Notes

Each subclass of base.Model has its own custom check_simulatable_factors method.

Returns

is_simulatable – True if model specified by factors is simulatable, otherwise False.

Return type

bool

replicate(rng_list)

Simulate a single replication for the current model factors.

Parameters

rng_list (list of mrg32k3a.mrg32k3a.MRG32k3a objects) – rngs for model to use when simulating a replication

Returns

responses – performance measures of interest “profit” = profit in this scenario “stockout_qty” = amount by which demand exceeded supply “stockout” = was there unmet demand? (Y/N)

Return type

dict

class simopt.models.cntnv.CntNVMaxProfit(name='CNTNEWS-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Base class to implement simulation-optimization problems.

name

name of problem

Type

string

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

string

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

string

lower_bounds

lower bound for each decision variable

Type

tuple

upper_bounds

upper bound for each decision variable

Type

tuple

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

Model object

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

model_decision_factors

set of keys for factors that are decision variables

Type

set of str

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

list of mrg32k3a.mrg32k3a.MRG32k3a objects

factors
changeable factors of the problem
initial_solutiontuple

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name for problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dictionary) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a object) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dictionary

simopt.models.contam module

Summary

Simulate contamination rates. A detailed description of the model/problem can be found here.

class simopt.models.contam.Contamination(fixed_factors=None)

Bases: Model

A model that simulates a contamination problem with a beta distribution. Returns the probability of violating contamination upper limit in each level of supply chain.

name

name of model

Type

string

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI and data validation)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (nested dict) – fixed factors of the simulation model

See also

base.Model

check_contam_rate_alpha()
check_contam_rate_beta()
check_initial_rate_alpha()
check_initial_rate_beta()
check_prev_cost()
check_prev_decision()
check_restore_rate_alpha()
check_restore_rate_beta()
check_simulatable_factors()

Determine if a simulation replication can be run with the given factors.

Notes

Each subclass of base.Model has its own custom check_simulatable_factors method.

Returns

is_simulatable – True if model specified by factors is simulatable, otherwise False.

Return type

bool

check_stages()
replicate(rng_list)

Simulate a single replication for the current model factors.

Parameters

rng_list (list of mrg32k3a.mrg32k3a.MRG32k3a objects) – rngs for model to use when simulating a replication

Returns

  • responses (dict) – performance measures of interest “level” = a list of contamination levels over time

  • gradients (dict of dicts) – gradient estimates for each response

class simopt.models.contam.ContaminationTotalCostCont(name='CONTAM-2', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Base class to implement simulation-optimization problems.

name

name of problem

Type

string

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

string

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

string

lower_bounds

lower bound for each decision variable

Type

tuple

upper_bounds

upper bound for each decision variable

Type

tuple

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

Model object

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

list of mrg32k3a.mrg32k3a.MRG32k3a objects

factors
changeable factors of the problem
initial_solutionlist

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

prev_costlist

cost of prevention

upper_thresfloat > 0

upper limit of amount of contamination

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name for problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_budget()

Check if budget is strictly positive.

Returns

True if budget is strictly positive, otherwise False.

Return type

bool

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

check_error_prob()
check_initial_solution()

Check if initial solution is feasible and of correct dimension.

Returns

True if initial solution is feasible and of correct dimension, otherwise False.

Return type

bool

check_prev_cost()
check_simulatable_factors()
check_upper_thres()
deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dictionary) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

factor_dict_to_vector_gradients(factor_dict)

Convert a dictionary with factor keys to a gradient vector.

Notes

A subclass of base.Problem can have its own custom factor_dict_to_vector_gradients method if the objective is deterministic.

Parameters

factor_dict (dict) – Dictionary with factor keys and associated values.

Returns

vector – Vector of partial derivatives associated with decision variables.

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a object) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_objectives_gradients(response_dict)

Convert a dictionary with response keys to a vector of gradients.

Notes

A subclass of base.Problem can have its own custom response_dict_to_objectives_gradients method if the objective is deterministic.

Parameters

response_dict (dict) – Dictionary with response keys and associated values.

Returns

Vector of gradients.

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dictionary

class simopt.models.contam.ContaminationTotalCostDisc(name='CONTAM-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Base class to implement simulation-optimization problems.

name

name of problem

Type

string

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

string

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

string

lower_bounds

lower bound for each decision variable

Type

tuple

upper_bounds

upper bound for each decision variable

Type

tuple

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

float

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

Model object

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

list of mrg32k3a.mrg32k3a.MRG32k3a objects

factors
changeable factors of the problem
initial_solutionlist

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

prev_costlist

cost of prevention

upper_thresfloat > 0

upper limit of amount of contamination

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name for problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

check_error_prob()
check_prev_cost()
check_upper_thres()
deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dictionary) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

factor_dict_to_vector_gradients(factor_dict)

Convert a dictionary with factor keys to a gradient vector.

Notes

A subclass of base.Problem can have its own custom factor_dict_to_vector_gradients method if the objective is deterministic.

Parameters

factor_dict (dict) – Dictionary with factor keys and associated values.

Returns

vector – Vector of partial derivatives associated with decision variables.

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a object) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_objectives_gradients(response_dict)

Convert a dictionary with response keys to a vector of gradients.

Notes

A subclass of base.Problem can have its own custom response_dict_to_objectives_gradients method if the objective is deterministic.

Parameters

response_dict (dict) – Dictionary with response keys and associated values.

Returns

Vector of gradients.

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dictionary

simopt.models.dualsourcing module

Summary

Simulate multiple periods of ordering and sales for a dual sourcing inventory problem. A detailed description of the model/problem can be found here.

class simopt.models.dualsourcing.DualSourcing(fixed_factors=None)

Bases: Model

A model that simulates multiple periods of ordering and sales for a single-staged, dual sourcing inventory problem with stochastic demand. Returns average holding cost, average penalty cost, and average ordering cost per period.

name

name of model

Type

str

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (dict) –

fixed_factors of the simulation model

n_days

Number of days to simulate (int)

initial_inv

Initial inventory (int)

cost_reg

Regular ordering cost per unit (flt)

cost_exp

Expedited ordering cost per unit (flt)

lead_reg

Lead time for regular orders in days (int)

lead_exp

Lead time for expedited orders in days (int)

holding_cost

Holding cost per unit per period (flt)

penalty_cost

Penalty cost per unit per period for backlogging(flt)

st_dev

Standard deviation of demand distribution (flt)

mu

Mean of demand distribution (flt)

order_level_reg

Order-up-to level for regular orders (int)

order_level_exp

Order-up-to level for expedited orders (int)

See also

base.Model

check_cost_exp()
check_cost_reg()
check_holding_cost()
check_initial_inv()
check_lead_exp()
check_lead_reg()
check_mu()
check_n_days()
check_order_level_exp()
check_order_level_reg()
check_penalty_cost()
check_simulatable_factors()

Determine if a simulation replication can be run with the given factors.

Notes

Each subclass of base.Model has its own custom check_simulatable_factors method.

Returns

is_simulatable – True if model specified by factors is simulatable, otherwise False.

Return type

bool

check_st_dev()
replicate(rng_list)

Simulate a single replication for the current model factors.

Parameters

rng_list ([list] [mrg32k3a.mrg32k3a.MRG32k3a]) – rngs for model to use when simulating a replication

Returns

responses – performance measures of interest

average_holding_cost

The average holding cost over the time period

average_penalty_cost

The average penalty cost over the time period

average_ordering_cost

The average ordering cost over the time period

Return type

dict

class simopt.models.dualsourcing.DualSourcingMinCost(name='DUALSOURCING-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Class to make dual-sourcing inventory simulation-optimization problems.

name

name of problem

Type

str

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

str

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

str

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

base.Model

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

model_decision_factors

set of keys for factors that are decision variables

Type

set of str

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

[list] [mrg32k3a.mrg32k3a.MRG32k3a]

factors
changeable factors of the problem
initial_solutiontuple

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name of problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dict) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dict) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dict) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys.

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dict

simopt.models.dynamnews module

Summary

Simulate a day’s worth of sales for a newsvendor under dynamic consumer substitution. A detailed description of the model/problem can be found here.

class simopt.models.dynamnews.DynamNews(fixed_factors=None)

Bases: Model

A model that simulates a day’s worth of sales for a newsvendor with dynamic consumer substitution. Returns the profit and the number of products that stock out.

name

name of model

Type

string

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (dict) – fixed_factors of the simulation model

See also

base.Model

check_c_utility()
check_cost()
check_init_level()
check_mu()
check_num_customer()
check_num_prod()
check_price()
check_simulatable_factors()

Determine if a simulation replication can be run with the given factors.

Notes

Each subclass of base.Model has its own custom check_simulatable_factors method.

Returns

is_simulatable – True if model specified by factors is simulatable, otherwise False.

Return type

bool

replicate(rng_list)

Simulate a single replication for the current model factors.

Parameters

rng_list (list of mrg32k3a.mrg32k3a.MRG32k3a objects) – rngs for model to use when simulating a replication

Returns

responses – performance measures of interest “profit” = profit in this scenario “n_prod_stockout” = number of products which are out of stock

Return type

dict

class simopt.models.dynamnews.DynamNewsMaxProfit(name='DYNAMNEWS-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Base class to implement simulation-optimization problems.

name

name of problem

Type

string

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

string

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

string

lower_bounds

lower bound for each decision variable

Type

tuple

upper_bounds

upper bound for each decision variable

Type

tuple

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

Model object

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

model_decision_factors

set of keys for factors that are decision variables

Type

set of str

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

list of mrg32k3a.mrg32k3a.MRG32k3a objects

factors
changeable factors of the problem
initial_solutiontuple

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name for problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dictionary) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a object) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dictionary

simopt.models.example module

Summary

Simulate a synthetic problem with a deterministic objective function evaluated with noise.

class simopt.models.example.ExampleModel(fixed_factors=None)

Bases: Model

A model that is a deterministic function evaluated with noise.

name

name of model

Type

string

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (dict) – fixed_factors of the simulation model

See also

base.Model

check_simulatable_factors()

Determine if a simulation replication can be run with the given factors.

Notes

Each subclass of base.Model has its own custom check_simulatable_factors method.

Returns

is_simulatable – True if model specified by factors is simulatable, otherwise False.

Return type

bool

check_x()
replicate(rng_list)

Evaluate a deterministic function f(x) with stochastic noise.

Parameters

rng_list (list of mrg32k3a.mrg32k3a.MRG32k3a objects) – rngs for model to use when simulating a replication

Returns

responses – performance measures of interest “est_f(x)” = f(x) evaluated with stochastic noise

Return type

dict

class simopt.models.example.ExampleProblem(name='EXAMPLE-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Base class to implement simulation-optimization problems.

name

name of problem

Type

string

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

string

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

string

lower_bounds

lower bound for each decision variable

Type

tuple

upper_bounds

upper bound for each decision variable

Type

tuple

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

Model object

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

model_decision_factors

set of keys for factors that are decision variables

Type

set of str

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

list of mrg32k3a.mrg32k3a.MRG32k3a objects

factors
changeable factors of the problem
initial_solutiontuple

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name for problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dictionary) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a object) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dictionary

simopt.models.facilitysizing module

Summary

Simulate demand at facilities. A detailed description of the model/problem can be found here.

class simopt.models.facilitysizing.FacilitySize(fixed_factors=None)

Bases: Model

A model that simulates a facilitysize problem with a multi-variate normal distribution. Returns the probability of violating demand in each scenario.

name

name of model

Type

string

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI and data validation)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (nested dict) – fixed factors of the simulation model

See also

base.Model

check_capacity()
check_cov()
check_mean_vec()
check_n_fac()
check_simulatable_factors()

Determine if a simulation replication can be run with the given factors.

Notes

Each subclass of base.Model has its own custom check_simulatable_factors method.

Returns

is_simulatable – True if model specified by factors is simulatable, otherwise False.

Return type

bool

replicate(rng_list)

Simulate a single replication for the current model factors.

Parameters

rng_list (list of mrg32k3a.mrg32k3a.MRG32k3a objects) – rngs for model to use when simulating a replication

Returns

  • responses (dict) – performance measures of interest “stockout_flag” = a binary variable

    0 : all facilities satisfy the demand 1 : at least one of the facilities did not satisfy the demand

    ”n_fac_stockout” = the number of facilities which cannot satisfy the demand “n_cut” = the number of toal demand which cannot be satisfied

  • gradients (dict of dicts) – gradient estimates for each response

class simopt.models.facilitysizing.FacilitySizingMaxService(name='FACSIZE-2', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Base class to implement simulation-optimization problems.

name

name of problem

Type

string

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

string

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

string

lower_bounds

lower bound for each decision variable

Type

tuple

upper_bounds

upper bound for each decision variable

Type

tuple

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

Model object

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

model_decision_factors

set of keys for factors that are decision variables

Type

set of str

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

list of mrg32k3a.mrg32k3a.MRG32k3a objects

factors
changeable factors of the problem
initial_solutiontuple

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name for problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

check_installation_budget()
check_installation_costs()
deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dictionary) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a object) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dictionary

class simopt.models.facilitysizing.FacilitySizingTotalCost(name='FACSIZE-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Base class to implement simulation-optimization problems.

name

name of problem

Type

string

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

string

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

string

lower_bounds

lower bound for each decision variable

Type

tuple

upper_bounds

upper bound for each decision variable

Type

tuple

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

float

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

Model object

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

model_decision_factors

set of keys for factors that are decision variables

Type

set of str

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

list of mrg32k3a.mrg32k3a.MRG32k3a objects

factors
changeable factors of the problem
initial_solutiontuple

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name for problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

check_epsilon()
check_installation_costs()
deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dictionary) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

factor_dict_to_vector_gradients(factor_dict)

Convert a dictionary with factor keys to a gradient vector.

Notes

A subclass of base.Problem can have its own custom factor_dict_to_vector_gradients method if the objective is deterministic.

Parameters

factor_dict (dict) – Dictionary with factor keys and associated values.

Returns

vector – Vector of partial derivatives associated with decision variables.

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a object) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_objectives_gradients(response_dict)

Convert a dictionary with response keys to a vector of gradients.

Notes

A subclass of base.Problem can have its own custom response_dict_to_objectives_gradients method if the objective is deterministic.

Parameters

response_dict (dict) – Dictionary with response keys and associated values.

Returns

Vector of gradients.

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dictionary

simopt.models.fixedsan module

Summary

Simulate duration of a stochastic activity network (SAN). A detailed description of the model/problem can be found here.

class simopt.models.fixedsan.FixedSAN(fixed_factors=None)

Bases: Model

A model that simulates a stochastic activity network problem with tasks that have exponentially distributed durations, and the selected means come with a cost.

name

name of model

Type

string

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI and data validation)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (nested dict) – fixed factors of the simulation model

See also

base.Model

check_arc_means()
check_num_arcs()
check_num_nodes()
replicate(rng_list)

Simulate a single replication for the current model factors.

Parameters

rng_list (list of mrg32k3a.mrg32k3a.MRG32k3a objects) – rngs for model to use when simulating a replication

Returns

  • responses (dict) – performance measures of interest “longest_path_length” = length/duration of longest path

  • gradients (dict of dicts) – gradient estimates for each response

class simopt.models.fixedsan.FixedSANLongestPath(name='FIXEDSAN-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Base class to implement simulation-optimization problems.

name

name of problem

Type

string

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

string

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

string

lower_bounds

lower bound for each decision variable

Type

tuple

upper_bounds

upper bound for each decision variable

Type

tuple

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

Model object

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

model_decision_factors

set of keys for factors that are decision variables

Type

set of str

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

list of mrg32k3a.mrg32k3a.MRG32k3a objects

factors
changeable factors of the problem
initial_solutionlist

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name for problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_arc_costs()
check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dictionary) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a object) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dictionary

simopt.models.hotel module

Summary

Simulate expected revenue for a hotel. A detailed description of the model/problem can be found here.

class simopt.models.hotel.Hotel(fixed_factors=None)

Bases: Model

A model that simulates business of a hotel with Poisson arrival rate.

name

name of model

Type

string

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI and data validation)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (nested dict) – fixed factors of the simulation model

See also

base.Model

check_booking_limits()
check_discount_rate()
check_lambda()
check_num_products()
check_num_rooms()
check_product_incidence()
check_rack_rate()
check_runlength()
check_time_before()
check_time_limit()
replicate(rng_list)

Simulate a single replication for the current model factors.

Parameters

rng_list (list of mrg32k3a.mrg32k3a.MRG32k3a objects) – rngs for model to use when simulating a replication

Returns

  • responses (dict) – performance measures of interest “revenue” = expected revenue

  • gradients (dict of dicts) – gradient estimates for each response

class simopt.models.hotel.HotelRevenue(name='HOTEL-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Base class to implement simulation-optimization problems.

name

name of problem

Type

string

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

string

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

string

lower_bounds

lower bound for each decision variable

Type

tuple

upper_bounds

upper bound for each decision variable

Type

tuple

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

Model object

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

model_decision_factors

set of keys for factors that are decision variables

Type

set of str

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

list of mrg32k3a.mrg32k3a.MRG32k3a objects

factors
changeable factors of the problem
initial_solutionlist

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name for problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_budget()

Check if budget is strictly positive.

Returns

True if budget is strictly positive, otherwise False.

Return type

bool

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

check_initial_solution()

Check if initial solution is feasible and of correct dimension.

Returns

True if initial solution is feasible and of correct dimension, otherwise False.

Return type

bool

check_simulatable_factors()
deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dictionary) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a object) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dictionary

simopt.models.ironore module

Summary

Simulate multiple periods of production and sales for an iron ore inventory problem. A detailed description of the model/problem can be found here.

Changed get_random_solution quantiles

from 10 and 200 => mean=59.887, sd=53.338, p(X>100)=0.146 to 10 and 1000 => mean=199.384, sd=343.925, p(X>100)=0.5

class simopt.models.ironore.IronOre(fixed_factors=None)

Bases: Model

A model that simulates multiple periods of production and sales for an inventory problem with stochastic price determined by a mean-reverting random walk. Returns total profit, fraction of days producing iron, and mean stock.

name

name of model

Type

str

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (dict) – fixed_factors of the simulation model

See also

base.Model

check_capacity()
check_holding_cost()
check_inven_stop()
check_max_price()
check_max_prod_perday()
check_mean_price()
check_min_price()
check_n_days()
check_price_prod()
check_price_sell()
check_price_stop()
check_prod_cost()
check_simulatable_factors()

Determine if a simulation replication can be run with the given factors.

Notes

Each subclass of base.Model has its own custom check_simulatable_factors method.

Returns

is_simulatable – True if model specified by factors is simulatable, otherwise False.

Return type

bool

check_st_dev()
replicate(rng_list)

Simulate a single replication for the current model factors.

Parameters

rng_list ([list] [mrg32k3a.mrg32k3a.MRG32k3a]) – rngs for model to use when simulating a replication

Returns

responses – performance measures of interest “total_profit” = The total profit over the time period “frac_producing” = The fraction of days spent producing iron ore “mean_stock” = The average stocks over the time period

Return type

dict

class simopt.models.ironore.IronOreMaxRev(name='IRONORE-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Class to make iron ore inventory simulation-optimization problems.

name

name of problem

Type

str

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

str

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

str

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

float

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

base.Model

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

model_decision_factors

set of keys for factors that are decision variables

Type

set of str

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

[list] [mrg32k3a.mrg32k3a.MRG32k3a]

factors
changeable factors of the problem
initial_solutiontuple

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name of problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dict) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dict) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dict) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dict

class simopt.models.ironore.IronOreMaxRevCnt(name='IRONORECONT-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Class to make iron ore inventory simulation-optimization problems.

name

name of problem

Type

str

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

str

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

str

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

base.Model

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

model_decision_factors

set of keys for factors that are decision variables

Type

set of str

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

[list] [mrg32k3a.mrg32k3a.MRG32k3a]

factors
changeable factors of the problem
initial_solutiontuple

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name of problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dict) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dict) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dict) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dict

simopt.models.mm1queue module

Summary

Simulate a M/M/1 queue. A detailed description of the model/problem can be found here.

class simopt.models.mm1queue.MM1MinMeanSojournTime(name='MM1-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Base class to implement simulation-optimization problems.

name

name of problem

Type

string

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

string

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

string

lower_bounds

lower bound for each decision variable

Type

tuple

upper_bounds

upper bound for each decision variable

Type

tuple

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

Model object

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

model_decision_factors

set of keys for factors that are decision variables

Type

set of str

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

list of mrg32k3a.mrg32k3a.MRG32k3a objects

factors

changeable factors of the problem

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name for problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • model_fixed_factors (dict) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dictionary) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a object) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dictionary

class simopt.models.mm1queue.MM1Queue(fixed_factors=None)

Bases: Model

A model that simulates an M/M/1 queue with an Exponential(lambda) interarrival time distribution and an Exponential(x) service time distribution. Returns

  • the average sojourn time

  • the average waiting time

  • the fraction of customers who wait

for customers after a warmup period.

name

name of model

Type

string

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (nested dict) – fixed factors of the simulation model

See also

base.Model

check_lambda()
check_mu()
check_people()
check_simulatable_factors()

Determine if a simulation replication can be run with the given factors.

Notes

Each subclass of base.Model has its own custom check_simulatable_factors method.

Returns

is_simulatable – True if model specified by factors is simulatable, otherwise False.

Return type

bool

check_warmup()
replicate(rng_list)

Simulate a single replication for the current model factors.

Parameters

rng_list (list of mrg32k3a.mrg32k3a.MRG32k3a objects) – rngs for model to use when simulating a replication

Returns

  • responses (dict) – performance measures of interest “avg_sojourn_time” = average sojourn time “avg_waiting_time” = average waiting time “frac_cust_wait” = fraction of customers who wait

  • gradients (dict of dicts) – gradient estimates for each response

simopt.models.network module

Summary

Simulate messages being processed in a queueing network. A detailed description of the model/problem can be found here.

class simopt.models.network.Network(fixed_factors=None)

Bases: Model

Simulate messages being processed in a queueing network.

name

name of model

Type

str

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (dict) – fixed_factors of the simulation model

See also

base.Model

check_arrival_rate()
check_cost_process()
check_cost_time()
check_lower_limits_transit_time()
check_mode_transit_time()
check_n_messages()
check_n_networks()
check_process_prob()
check_simulatable_factors()

Determine if a simulation replication can be run with the given factors.

Notes

Each subclass of base.Model has its own custom check_simulatable_factors method.

Returns

is_simulatable – True if model specified by factors is simulatable, otherwise False.

Return type

bool

check_upper_limits_transit_time()
replicate(rng_list)

Simulate a single replication for the current model factors.

Parameters

rng_list (list of mrg32k3a.mrg32k3a.MRG32k3a objects) – rngs for model to use when simulating a replication

Returns

  • responses (dict) – performance measure of interest “total_cost”: total cost spent to route all messages

  • gradients (dict of dicts) – gradient estimates for each response

class simopt.models.network.NetworkMinTotalCost(name='NETWORK-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Base class to implement simulation-optimization problems.

name

name of problem

Type

string

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

string

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

string

lower_bounds

lower bound for each decision variable

Type

tuple

upper_bounds

upper bound for each decision variable

Type

tuple

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

Model object

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

model_decision_factors

set of keys for factors that are decision variables

Type

set of str

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

list of mrg32k3a.mrg32k3a.MRG32k3a objects

factors

changeable factors of the problem

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name for problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • model_fixed_factors (dict) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dictionary) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a object) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dictionary

simopt.models.paramesti module

Summary

Simulate MLE estimation for the parameters of a two-dimensional gamma distribution. A detailed description of the model/problem can be found here.

class simopt.models.paramesti.ParamEstiMaxLogLik(name='PARAMESTI-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Base class to implement simulation-optimization problems.

name

name of problem

Type

string

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

string

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

string

lower_bounds

lower bound for each decision variable

Type

tuple

upper_bounds

upper bound for each decision variable

Type

tuple

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

model object

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

list of mrg32k3a.mrg32k3a.MRG32k3a objects

factors
changeable factors of the problem
initial_solutionlist

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

prev_costlist

cost of prevention

upper_thresfloat > 0

upper limit of amount of contamination

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name for problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dictionary) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a object) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dictionary

class simopt.models.paramesti.ParameterEstimation(fixed_factors=None)

Bases: Model

A model that simulates MLE estimation for the parameters of a two-dimensional gamma distribution.

name

name of model

Type

string

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI and data validation)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (nested dict) – fixed factors of the simulation model

See also

base.model

check_simulatable_factors()

Determine if a simulation replication can be run with the given factors.

Notes

Each subclass of base.Model has its own custom check_simulatable_factors method.

Returns

is_simulatable – True if model specified by factors is simulatable, otherwise False.

Return type

bool

check_x()
check_xstar()
replicate(rng_list)

Simulate a single replication for the current model factors.

Parameters

rng_list (list of mrg32k3a.mrg32k3a.MRG32k3a objects) – rngs for model to use when simulating a replication

Returns

  • responses (dict) – performance measures of interest “loglik” = the corresponding loglikelihood

  • gradients (dict of dicts) – gradient estimates for each response

simopt.models.rmitd module

Summary

Simulate a multi-stage revenue management system with inter-temporal dependence. A detailed description of the model/problem can be found here.

class simopt.models.rmitd.RMITD(fixed_factors=None)

Bases: Model

A model that simulates a multi-stage revenue management system with inter-temporal dependence. Returns the total revenue.

name

name of model

Type

string

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI and data validation)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (nested dict) – fixed factors of the simulation model

See also

base.Model

check_cost()
check_demand_means()
check_gamma_scale()
check_gamma_shape()
check_initial_inventory()
check_prices()
check_reservation_qtys()
check_simulatable_factors()

Determine if a simulation replication can be run with the given factors.

Notes

Each subclass of base.Model has its own custom check_simulatable_factors method.

Returns

is_simulatable – True if model specified by factors is simulatable, otherwise False.

Return type

bool

check_time_horizon()
replicate(rng_list)

Simulate a single replication for the current model factors.

Parameters

rng_list (list of mrg32k3a.mrg32k3a.MRG32k3a objects) – rngs for model to use when simulating a replication

Returns

  • responses (dict) – performance measures of interest “revenue” = total revenue

  • gradients (dict of dicts) – gradient estimates for each response

class simopt.models.rmitd.RMITDMaxRevenue(name='RMITD-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Base class to implement simulation-optimization problems.

name

name of problem

Type

string

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

string

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

string

lower_bounds

lower bound for each decision variable

Type

tuple

upper_bounds

upper bound for each decision variable

Type

tuple

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

Model object

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

model_decision_factors

set of keys for factors that are decision variables

Type

set of str

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

list of mrg32k3a.mrg32k3a.MRG32k3a objects

factors
changeable factors of the problem
initial_solutiontuple

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name for problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • model_fixed_factors (dict) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dictionary) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a object) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dictionary

simopt.models.san module

Summary

Simulate duration of a stochastic activity network (SAN). A detailed description of the model/problem can be found here.

class simopt.models.san.SAN(fixed_factors=None)

Bases: Model

A model that simulates a stochastic activity network problem with tasks that have exponentially distributed durations, and the selected means come with a cost.

name

name of model

Type

string

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI and data validation)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (nested dict) – fixed factors of the simulation model

See also

base.Model

check_arc_means()
check_arcs()
check_num_nodes()
dfs(graph, start, visited=None)
replicate(rng_list)

Simulate a single replication for the current model factors.

Parameters

rng_list (list of mrg32k3a.mrg32k3a.MRG32k3a) – rngs for model to use when simulating a replication

Returns

  • responses (dict) – performance measures of interest “longest_path_length” = length/duration of longest path

  • gradients (dict of dicts) – gradient estimates for each response

class simopt.models.san.SANLongestPath(name='SAN-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Base class to implement simulation-optimization problems.

name

name of problem

Type

string

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

string

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

string

lower_bounds

lower bound for each decision variable

Type

tuple

upper_bounds

upper bound for each decision variable

Type

tuple

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

Model object

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

model_decision_factors

set of keys for factors that are decision variables

Type

set of str

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

list of mrg32k3a.mrg32k3a.MRG32k3a objects

factors
changeable factors of the problem
initial_solutionlist

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name for problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_arc_costs()
check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dictionary) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a object) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dictionary) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dictionary

simopt.models.sscont module

Summary

Simulate multiple periods worth of sales for a (s,S) inventory problem with continuous inventory. A detailed description of the model/problem can be found here.

class simopt.models.sscont.SSCont(fixed_factors=None)

Bases: Model

A model that simulates multiple periods’ worth of sales for a (s,S) inventory problem with continuous inventory, exponentially distributed demand, and poisson distributed lead time. Returns the various types of average costs per period, order rate, stockout rate, fraction of demand met with inventory on hand, average amount backordered given a stockout occured, and average amount ordered given an order occured.

name

name of model

Type

str

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (dict) –

fixed_factors of the simulation model

demand_mean

Mean of exponentially distributed demand in each period (flt)

lead_mean

Mean of Poisson distributed order lead time (flt)

backorder_cost

Cost per unit of demand not met with in-stock inventory (flt)

holding_cost

Holding cost per unit per period (flt)

fixed_cost

Order fixed cost (flt)

variable_cost

Order variable cost per unit (flt)

s

Inventory position threshold for placing order (flt)

S

Max inventory position (flt)

n_days

Number of periods to simulate (int)

warmup

Number of periods as warmup before collecting statistics (int)

See also

base.Model

check_S()
check_backorder_cost()
check_demand_mean()
check_fixed_cost()
check_holding_cost()
check_lead_mean()
check_n_days()
check_s()
check_simulatable_factors()

Determine if a simulation replication can be run with the given factors.

Notes

Each subclass of base.Model has its own custom check_simulatable_factors method.

Returns

is_simulatable – True if model specified by factors is simulatable, otherwise False.

Return type

bool

check_variable_cost()
check_warmup()
replicate(rng_list)

Simulate a single replication for the current model factors.

Parameters

rng_list ([list] [mrg32k3a.mrg32k3a.MRG32k3a]) – rngs for model to use when simulating a replication

Returns

responses – performance measures of interest

avg_backorder_costs

average backorder costs per period

avg_order_costs

average order costs per period

avg_holding_costs

average holding costs per period

on_time_rate

fraction of demand met with stock on hand in store

order_rate

fraction of periods an order was made

stockout_rate

fraction of periods a stockout occured

avg_stockout

mean amount of product backordered given a stockout occured

avg_order

mean amount of product ordered given an order occured

Return type

dict

class simopt.models.sscont.SSContMinCost(name='SSCONT-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Class to make (s,S) inventory simulation-optimization problems.

name

name of problem

Type

str

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

str

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

str

lower_bounds

lower bound for each decision variable

Type

tuple

upper_bounds

upper bound for each decision variable

Type

tuple

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

base.Model

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

model_decision_factors

set of keys for factors that are decision variables

Type

set of str

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

[list] [mrg32k3a.mrg32k3a.MRG32k3a]

factors
changeable factors of the problem
initial_solutiontuple

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name of problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dict) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dict) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dict) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dict

simopt.models.tableallocation module

Summary

Simulate multiple periods of arrival and seating at a restaurant. A detailed description of the model/problem can be found here.

class simopt.models.tableallocation.TableAllocation(fixed_factors=None)

Bases: Model

A model that simulates a table capacity allocation problem at a restaurant with a homogenous Poisson arrvial process and exponential service times. Returns expected maximum revenue.

name

name of model

Type

str

n_rngs

number of random-number generators used to run a simulation replication

Type

int

n_responses

number of responses (performance measures)

Type

int

factors

changeable factors of the simulation model

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

check_factor_list

switch case for checking factor simulatability

Type

dict

Parameters

fixed_factors (dict) –

fixed_factors of the simulation model

n_hours

Number of hours to simulate (int)

capacity

Maximum total capacity (int)

table_cap

Capacity of each type of table (int)

lambda

Average number of arrivals per hour (flt)

service_time_means

Mean service time in minutes (flt)

table_revenue

Per table revenue earned (flt)

num_tables

Number of tables of each capacity (int)

See also

base.Model

check_capacity()
check_lambda()
check_n_hours()
check_num_tables()
check_service_time_means()
check_simulatable_factors()

Determine if a simulation replication can be run with the given factors.

Notes

Each subclass of base.Model has its own custom check_simulatable_factors method.

Returns

is_simulatable – True if model specified by factors is simulatable, otherwise False.

Return type

bool

check_table_cap()
check_table_revenue()
replicate(rng_list)

Simulate a single replication for the current model factors.

Parameters

rng_list ([list] [mrg32k3a.mrg32k3a.MRG32k3a]) – rngs for model to use when simulating a replication

Returns

responses – performance measures of interest

total_revenue

Total revenue earned over the simulation period.

service_rate

Fraction of customer arrivals that are seated.

Return type

dict

class simopt.models.tableallocation.TableAllocationMaxRev(name='TABLEALLOCATION-1', fixed_factors=None, model_fixed_factors=None)

Bases: Problem

Class to make table allocation simulation-optimization problems.

name

name of problem

Type

str

dim

number of decision variables

Type

int

n_objectives

number of objectives

Type

int

n_stochastic_constraints

number of stochastic constraints

Type

int

minmax

indicator of maximization (+1) or minimization (-1) for each objective

Type

tuple of int (+/- 1)

constraint_type
description of constraints types:

“unconstrained”, “box”, “deterministic”, “stochastic”

Type

str

variable_type
description of variable types:

“discrete”, “continuous”, “mixed”

Type

str

gradient_available

indicates if gradient of objective function is available

Type

bool

optimal_value

optimal objective function value

Type

tuple

optimal_solution

optimal solution

Type

tuple

model

associated simulation model that generates replications

Type

base.Model

model_default_factors

default values for overriding model-level default factors

Type

dict

model_fixed_factors

combination of overriden model-level factors and defaults

Type

dict

model_decision_factors

set of keys for factors that are decision variables

Type

set of str

rng_list

list of RNGs used to generate a random initial solution or a random problem instance

Type

[list] [mrg32k3a.mrg32k3a.MRG32k3a]

factors
changeable factors of the problem
initial_solutiontuple

default initial solution from which solvers start

budgetint > 0

max number of replications (fn evals) for a solver to take

Type

dict

specifications

details of each factor (for GUI, data validation, and defaults)

Type

dict

Parameters
  • name (str) – user-specified name of problem

  • fixed_factors (dict) – dictionary of user-specified problem factors

  • factors (model_fixed) – subset of user-specified non-decision factors to pass through to the model

See also

base.Problem

check_deterministic_constraints(x)

Check if a solution x satisfies the problem’s deterministic constraints.

Parameters

x (tuple) – vector of decision variables

Returns

satisfies – indicates if solution x satisfies the deterministic constraints.

Return type

bool

deterministic_objectives_and_gradients(x)

Compute deterministic components of objectives for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_objectives (tuple) – vector of deterministic components of objectives

  • det_objectives_gradients (tuple) – vector of gradients of deterministic components of objectives

deterministic_stochastic_constraints_and_gradients(x)

Compute deterministic components of stochastic constraints for a solution x.

Parameters

x (tuple) – vector of decision variables

Returns

  • det_stoch_constraints (tuple) – vector of deterministic components of stochastic constraints

  • det_stoch_constraints_gradients (tuple) – vector of gradients of deterministic components of stochastic constraints

factor_dict_to_vector(factor_dict)

Convert a dictionary with factor keys to a vector of variables.

Parameters

factor_dict (dict) – dictionary with factor keys and associated values

Returns

vector – vector of values associated with decision variables

Return type

tuple

get_random_solution(rand_sol_rng)

Generate a random solution for starting or restarting solvers.

Parameters

rand_sol_rng (mrg32k3a.mrg32k3a.MRG32k3a) – random-number generator used to sample a new random solution

Returns

x – vector of decision variables

Return type

tuple

response_dict_to_objectives(response_dict)

Convert a dictionary with response keys to a vector of objectives.

Parameters

response_dict (dict) – dictionary with response keys and associated values

Returns

objectives – vector of objectives

Return type

tuple

response_dict_to_stoch_constraints(response_dict)

Convert a dictionary with response keys to a vector of left-hand sides of stochastic constraints: E[Y] <= 0

Parameters

response_dict (dict) – dictionary with response keys and associated values

Returns

stoch_constraints – vector of LHSs of stochastic constraint

Return type

tuple

vector_to_factor_dict(vector)

Convert a vector of variables to a dictionary with factor keys

Parameters

vector (tuple) – vector of values associated with decision variables

Returns

factor_dict – dictionary with factor keys and associated values

Return type

dict

Module contents