dlib Optimization Method¶
Implements the global_function_search method from dlib [1]. For brevity this method is simply referred to as “dlib” in this documentation and in rsopt. This method is based on using the approximated Lipschitz constant to define an upper bound on the search space that guides the optimization. This method is particularly attractive because it requires no hyper parameter choices. For a very nice description of the method’s operation see here.
The dlib algorithm works in parallel and supports use of arbitrary numbers of workers nworkers in options.
The dlib library is not included as part of rsopt’s install requirements. For information about installing dlib for Python see dlib’s instructions.
Configuration¶
Requirements and optional keys for setting up the configuration file to use dlib are given below.
Codes Blocks¶
No special configuration is needed in any portion of the codes blocks to use dlib.
Options¶
The following required and optional keys can be used within the options: block:
software[str (required)]:dlib
Objective Function¶
The objective function must return a single value of type float. Minimization of the objective is always assumed.
1 # As passed to options.objective_function:
2 def obj_f(J):
3 # Objective function is always passed
4 # to the rsopt job dictionary `J`
5
6 # ... Code to calculate objective value `f`
7
8 return f
9
10 # Example if using code block type `python`
11 # without options.objective_function:
12 def my_function(x, y):
13 # Assuming user defined `parameters` (x, y)
14 # in the configuration file
15
16 f = x**2 + y**2 + x * y
17
18 return f
Example Options Block¶
options:
software: dlib
# 9 workers will run simulations. 1 worker will be running pysot.
nworkers: 10
exit_criteria:
sim_max: 400
# objective_function can be optional if using python in codes
objective_function: [objective.py, obj_f]