optunity.solvers.util module

class optunity.solvers.util.Solver[source]

Bases: abc.SolverBase

Base class of all Optunity solvers.

maximize(f, pmap=<built-in function map>)[source]

Maximizes f.

Parameters:
  • f (callable) – the objective function
  • pmap (callable) – the map() function to use
Returns:

  • the arguments which optimize f
  • an optional solver report, can be None

minimize(f, pmap=<built-in function map>)[source]

Minimizes f.

Parameters:
  • f (callable) – the objective function
  • pmap (callable) – the map() function to use
Returns:

  • the arguments which optimize f
  • an optional solver report, can be None

optimize(f, maximize=True, pmap=<built-in function map>)[source]

Optimizes f.

Parameters:
  • f (callable) – the objective function
  • maximize (boolean) – do we want to maximizes?
  • pmap (callable) – the map() function to use
Returns:

  • the arguments which optimize f
  • an optional solver report, can be None

optunity.solvers.util.shrink_bounds(bounds, coverage=0.99)[source]

Shrinks the bounds. The new bounds will cover the fraction coverage.

>>> [round(x, 3) for x in shrink_bounds([0, 1], coverage=0.99)]
[0.005, 0.995]
optunity.solvers.util.uniform_in_bounds(bounds)[source]

Generates a random uniform sample between bounds.

Parameters:bounds (dict {“name”: [lb ub], ...}) – the bounds we must adhere to

Table Of Contents

This Page

Previous topic

optunity.solvers.solver_registry module

Next topic

Cross-validation