flopt
latest

Contents:

  • Installation
  • Tutorial
  • Case Studies
  • Solvers
    • Solver Selector
    • Iterative Search
    • Swarm Intelligence Search
    • Baysian Search
      • OptunaTPESearch
        • OptunaTPESearch
      • HyperoptSearch
        • HyperoptSearch
    • Evolution Search
    • Quadratic Programming Search
    • Linear Programming Search
    • non-Linear Programming Search
    • Quantum Annealing Search
  • API Reference
  • Internal Reference
  • Recipes
flopt
  • Solvers
  • Baysian Search
  • Edit on GitHub

Baysian Search

OptunaTPESearch

Solver name is “OptunaTPE”.

https://img.shields.io/badge/Variable-Number-blue.svghttps://img.shields.io/badge/Objective-any-orange.svghttps://img.shields.io/badge/Constraints-None-green.svg
class flopt.solvers.optuna_searches.OptunaTPESearch[source]

Tree-structured Parzen Estimator (TPE) Sampling Search of Optuna. https://optuna.readthedocs.io/en/latest/reference/samplers/generated/optuna.samplers.TPESampler.html This solver can solve constrainted problems, but it cannot handle equal constraints well.

Parameters:
  • name (str) – name

  • consider_prior (bool) –

  • consider_magic_clip (bool) –

  • consider_endpoints (bool) –

  • n_startup_trials (int) –

  • n_ei_candidates (int) –

  • seed (float) – seed of random generater

Examples

import flopt

x = flopt.Variable("x", lowBound=-1, upBound=1, cat="Continuous")
y = flopt.Variable("y", lowBound=-1, upBound=1, cat="Continuous")

prob = flopt.Problem()
prob += 2*x*x + x*y + y*y + x + y
prob += x + y >= 0

status, log = prob.solve(solver="OptunaTPE", msg=True, timelimit=1)

print("obj =", flopt.Value(prob.obj))
print("x =", flopt.Value(x))
print("y =", flopt.Value(y))

HyperoptSearch

Solver name is “Hyperopt”.

https://img.shields.io/badge/Variable-Number-blue.svghttps://img.shields.io/badge/Objective-any-orange.svghttps://img.shields.io/badge/Constraints-None-green.svg
class flopt.solvers.hyperopt_search.HyperoptSearch[source]

TPE Search using Hyperopt (https://hyperopt.github.io/hyperopt/)

Parameters:
  • n_trial (int) – number of trials

  • show_progressbar (bool) – whether display a progress bar of search

Examples

import flopt

x = flopt.Variable("x", lowBound=-1, upBound=1, cat="Continuous")
y = flopt.Variable("y", lowBound=-1, upBound=1, cat="Continuous")

prob = flopt.Problem()
prob += 2*x*x + x*y + y*y + x + y

status, log = prob.solve(solver="Hyperopt", msg=True, timelimit=1)

print("obj =", flopt.Value(prob.obj))
print("x =", flopt.Value(x))
print("y =", flopt.Value(y))
Previous Next

© Copyright 2021, Nariaki Tateiwa. Revision ff418914.

Built with Sphinx using a theme provided by Read the Docs.