| Title: | Parameter Optimization Functions for 'simmer' |
|---|---|
| Description: | A set of optimization functions for variable optimization in simmer simulations. |
| Authors: | Bart Smeets [aut, cph, cre], IƱaki Ucar [aut, cph] (ORCID: <https://orcid.org/0000-0001-6403-5550>) |
| Maintainer: | Bart Smeets <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.1 |
| Built: | 2026-06-01 10:05:07 UTC |
| Source: | https://github.com/r-simmer/simmer.optim |
Assert that average waiting time < max_val
assert_avg_waiting_time_max(envs, max_val)assert_avg_waiting_time_max(envs, max_val)
envs |
a list of |
max_val |
the max waiting time duration |
Assert that waiting time < max_val
assert_waiting_time_max(envs, max_val)assert_waiting_time_max(envs, max_val)
envs |
a list of |
max_val |
the max waiting time duration |
Evaluator for the constraint functions
constraints_evaluator(envs, constraints)constraints_evaluator(envs, constraints)
envs |
a list of |
constraints |
a list of constraint functions |
Implements the functionality of the DEoptim package.
de_optim( model, direction = c("min", "max"), objective, constraints, params, control, big_m = 1e+06 )de_optim( model, direction = c("min", "max"), objective, constraints, params, control, big_m = 1e+06 )
model |
the simmer model encapsulated in a function |
direction |
optimization direction ( |
objective |
the objective function |
constraints |
a list of constraint functions |
params |
a list of parameters to optimize over |
control |
a control list created by a call to |
big_m |
a penalty value for solutions with non-satisfied constraints |
Executes an exhaustive search over the solution space
grid_optim( model, direction = c("min", "max"), objective, constraints, params, control )grid_optim( model, direction = c("min", "max"), objective, constraints, params, control )
model |
the simmer model encapsulated in a function |
direction |
optimization direction ( |
objective |
the objective function |
constraints |
a list of constraint functions |
params |
a list of parameters to optimize over |
control |
a control list created by a call to |
A helper function to return the results of an optimization method to the optimization framework
method_results( method, objective_value, constraints_satisfied, params, envs = NULL, extra_info = list() )method_results( method, objective_value, constraints_satisfied, params, envs = NULL, extra_info = list() )
method |
the name of the optimization function (string) |
objective_value |
the value of the objective |
constraints_satisfied |
boolean indicating whether or not all constraints were satisfied |
params |
the found parameters |
envs |
a copy of the generated envs (optional) |
extra_info |
a list of extra information (optional) |
Measure the number of finished arrivals
msr_arrivals_finished(envs, agg = mean)msr_arrivals_finished(envs, agg = mean)
envs |
a list of |
agg |
the method of aggregation of per replication results |
Measure the number of rejected arrivals
msr_arrivals_rejected(envs, agg = mean)msr_arrivals_rejected(envs, agg = mean)
envs |
a list of |
agg |
the method of aggregation of per replication results |
Measure the capacity of a resource type
msr_resource_capacity(envs, name, agg = mean)msr_resource_capacity(envs, name, agg = mean)
envs |
a list of |
name |
the name of the resource |
agg |
the method of aggregation of per replication results |
Measure the utilization of a resource type
msr_resource_utilization(envs, name, agg = mean)msr_resource_utilization(envs, name, agg = mean)
envs |
a list of |
name |
the name of the resource |
agg |
the method of aggregation of per replication results |
Measure the runtime of the model
msr_runtime(envs, agg = mean)msr_runtime(envs, agg = mean)
envs |
a list of |
agg |
the method of aggregation of per replication results |
Evaluator for the objective function
objective_evaluator(envs, objective)objective_evaluator(envs, objective)
envs |
a list of |
objective |
an objective function |
Internal usage
opt_func(params)opt_func(params)
params |
a named list of params |
Control object to configure the optimization procedure
optim_control( run_args = list(until = 1000), replications = 1, parallel = FALSE, verbose = FALSE, ... )optim_control( run_args = list(until = 1000), replications = 1, parallel = FALSE, verbose = FALSE, ... )
run_args |
the run arguments, a list with the following arguments: |
replications |
the number of replications |
parallel |
whether or not replications should be run in parallel (leveraging |
verbose |
boolean determining verbosity |
... |
extra named arguments added to the control object |
Function to pass results of simmer evaluation back to the optimization framework
optim_results(objective, constraints = list(), envs = NULL)optim_results(objective, constraints = list(), envs = NULL)
objective |
the value of the objective |
constraints |
a list with named objectives containing only TRUE and FALSE values |
envs |
the simmer env (OPTIONAL) |
A parameter vector of type continuous
par_continuous(vec)par_continuous(vec)
vec |
the original vector |
A parameter vector of type discrete
par_discrete(vec)par_discrete(vec)
vec |
the original vector |
Show the results of an optimization procedure
results(optim_obj)results(optim_obj)
optim_obj |
the optimization object |
Run n simmer models
run_instance(model, control, params)run_instance(model, control, params)
model |
the simmer model |
control |
the |
params |
a list of named parameters to be passed to the simmer expression and accessible for the model through the |
For this to work an envs object has to be returned with the optim_results
run_optimized(optim_obj)run_optimized(optim_obj)
optim_obj |
the optimization object |
results
Implements the functionality of the GenSA package.
sa_optim( model, direction = c("min", "max"), objective, constraints, params, control, big_m = 1e+06 )sa_optim( model, direction = c("min", "max"), objective, constraints, params, control, big_m = 1e+06 )
model |
the simmer model encapsulated in a function |
direction |
optimization direction ( |
objective |
the objective function |
constraints |
a list of constraint functions |
params |
a list of parameters to optimize over |
control |
a control list created by a call to |
big_m |
a penalty value for solutions with non-satisfied constraints |
Main entry point for the simmer optimization framework
simmer_optim( model, method, direction = "max", objective = msr_arrivals_finished, constraints, params = list(), control = optim_control(), ... )simmer_optim( model, method, direction = "max", objective = msr_arrivals_finished, constraints, params = list(), control = optim_control(), ... )
model |
the simmer model encapsulated in a function |
method |
the method to be used (e.g. |
direction |
optimization direction ( |
objective |
the objective function |
constraints |
a list of constraint functions |
params |
a list of parameters to optimize over |
control |
a control list created by a call to |
... |
extra parameters that are passed on to the optimization procedure |
Helper function to run objective / constraint functions with specified arguments
with_args(f, ...)with_args(f, ...)
f |
the objective / constraint function |
... |
a list of named arguments which will be used in the call to |