From 395e61f52572e18053f4736634b8ccfa45d7fb1b Mon Sep 17 00:00:00 2001 From: Louis-Justin TALLOT <72044417+LouisJustinTALLOT@users.noreply.github.com> Date: Fri, 3 Feb 2023 09:50:21 +0100 Subject: [PATCH] Docs / optimization : Rephrasing + fix broken code blocks --- docs/optimization.rst | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/optimization.rst b/docs/optimization.rst index 891d8794b..e82061214 100644 --- a/docs/optimization.rst +++ b/docs/optimization.rst @@ -58,7 +58,7 @@ Ask and tell interface An *ask and tell* interface is also available. The 3 key methods for this interface are respectively: - :code:`ask`: suggest a candidate on which to evaluate the function to optimize. -- :code:`tell`: for updated the optimizer with the value of the function for a candidate. +- :code:`tell`: to update the optimizer with the value of the function for a candidate. - :code:`provide_recommendation`: returns the candidate the algorithms considers the best. For most optimization algorithms in the platform, they can be called in arbitrary order - asynchronous optimization is OK. Some algorithms (with class attribute :code:`no_parallelization=True` however do not support this. @@ -154,18 +154,28 @@ Optimization with constraints Sometimes you want the best candidate, given some constraints. Then, if you want to work with the ask/tell form, instead of + .. code-block:: python + optimizer.tell(candidate, value) + you can do + .. code-block:: python + optimizer.tell(candidate, value, [constraint_violation1, constraint_violation2, constraint_violation3]) Or, if you work with minimize, you can also replace + .. code-block:: python + optimizer.minimize(loss_function) + by .. code-block:: python + optimizer.minimize(loss_function, constraint_violations) + where constraint_violations maps a candidate to a vector of constraint violations.