From dba617b874b79949b985de3763f7c4da85d2be7c Mon Sep 17 00:00:00 2001 From: TerenceLiu Date: Thu, 10 Nov 2022 17:21:38 +0800 Subject: [PATCH] Update 'algorithm/optimization/gradient.py' --- algorithm/optimization/gradient.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/algorithm/optimization/gradient.py b/algorithm/optimization/gradient.py index 0cecdb6..c70ece3 100644 --- a/algorithm/optimization/gradient.py +++ b/algorithm/optimization/gradient.py @@ -150,7 +150,7 @@ class gd2d(object): def initialization_default(self, environ): pio.renderers.default = environ # 'notebook' or 'colab' or 'jupyterlab' - self.wg_expr = widgets.Dropdown(options=[("(1 - 8 * x1 + 7 * x1**2 - (7/3) * x1**3 + (1/4) * x1**4) * x2**2 * E**(-x2)", "(1 - 8 * x1 + 7 * x1**2 - (7/3) * x1**3 + (1/4) * x1**4) * x2**2 * E**(-x2)"), ("(sin(x1) - 2) ** 2 + (sin(x2) - 2) ** 2", "(sin(x1) - 2) ** 2 + (sin(x2) - 2) ** 2")], value="(1 - 8 * x1 + 7 * x1**2 - (7/3) * x1**3 + (1/4) * x1**4) * x2**2 * E**(-x2)", descrption="Expression") + self.wg_expr = widgets.Dropdown(options=[("(1 - 8 * x1 + 7 * x1**2 - (7/3) * x1**3 + (1/4) * x1**4) * x2**2 * E**(-x2)", "(1 - 8 * x1 + 7 * x1**2 - (7/3) * x1**3 + (1/4) * x1**4) * x2**2 * E**(-x2)"), ("x1 - x2 + 2*x1*x2 + 2*x1**2 + x2**2", "x1 - x2 + 2*x1*x2 + 2*x1**2 + x2**2")], value="(1 - 8 * x1 + 7 * x1**2 - (7/3) * x1**3 + (1/4) * x1**4) * x2**2 * E**(-x2)", descrption="Expression") self.wg_x0 = widgets.Text(value="0,2", description="Startpoint:") self.wg_lr = widgets.FloatText(value="1e-1", description="step size:") self.wg_epsilon = widgets.FloatText(value="1e-5", description="criterion:") @@ -314,7 +314,7 @@ class gd2d_compete(object): def initialization(self, environ): pio.renderers.default = environ # 'notebook' or 'colab' or 'jupyterlab' self.timer = 0 - self.wg_expr = widgets.Dropdown(options=[("(1 - 8 * x1 + 7 * x1**2 - (7/3) * x1**3 + (1/4) * x1**4) * x2**2 * E**(-x2)", "(1 - 8 * x1 + 7 * x1**2 - (7/3) * x1**3 + (1/4) * x1**4) * x2**2 * E**(-x2)"), ("x1 - x2 + 2x1*x2 + 2x1**2 + x2**2", "x1 - x2 + 2x1*x2 + 2x1**2 + x2**2")], value="(1 - 8 * x1 + 7 * x1**2 - (7/3) * x1**3 + (1/4) * x1**4) * x2**2 * E**(-x2)", descrption="Expression") + self.wg_expr = widgets.Dropdown(options=[("(1 - 8 * x1 + 7 * x1**2 - (7/3) * x1**3 + (1/4) * x1**4) * x2**2 * E**(-x2)", "(1 - 8 * x1 + 7 * x1**2 - (7/3) * x1**3 + (1/4) * x1**4) * x2**2 * E**(-x2)"), ("x1 - x2 + 2*x1*x2 + 2*x1**2 + x2**2", "x1 - x2 + 2*x1*x2 + 2*x1**2 + x2**2")], value="(1 - 8 * x1 + 7 * x1**2 - (7/3) * x1**3 + (1/4) * x1**4) * x2**2 * E**(-x2)", descrption="Expression") self.wg_x0 = widgets.Text(value="0,2", description="Init point:") self.wg_lr = widgets.FloatText(value="0.1", description="step size:") self.wg_direction_p0 = widgets.Text(value="0.5,1", description="Direction (a1)")