Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions SU2_PY/SU2/opt/scipy_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ def scipy_cg(project, x0=None, xb=None, its=100, accu=1e-10, grads=True):
fprime = obj_df

# number of design variables
n_dv = len(project.config["DEFINITION_DV"]["KIND"])
dv_size = project.config["DEFINITION_DV"]["SIZE"]
n_dv = sum(dv_size)
project.n_dv = n_dv

# Initial guess
Expand All @@ -196,7 +197,8 @@ def scipy_cg(project, x0=None, xb=None, its=100, accu=1e-10, grads=True):

# prescale x0
dv_scales = project.config["DEFINITION_DV"]["SCALE"]
x0 = [x0[i] / dv_scl for i, dv_scl in enumerate(dv_scales)]
x0_scales = [scl for scl, size in zip(dv_scales, dv_size) for _ in range(size)]
x0 = [x / scl for x, scl in zip(x0, x0_scales)]

# scale accuracy
obj = project.config["OPT_OBJECTIVE"]
Expand Down Expand Up @@ -279,7 +281,8 @@ def scipy_bfgs(project, x0=None, xb=None, its=100, accu=1e-10, grads=True):
fprime = obj_df

# number of design variables
n_dv = len(project.config["DEFINITION_DV"]["KIND"])
dv_size = project.config["DEFINITION_DV"]["SIZE"]
n_dv = sum(dv_size)
project.n_dv = n_dv

# Initial guess
Expand All @@ -288,7 +291,8 @@ def scipy_bfgs(project, x0=None, xb=None, its=100, accu=1e-10, grads=True):

# prescale x0
dv_scales = project.config["DEFINITION_DV"]["SCALE"]
x0 = [x0[i] / dv_scl for i, dv_scl in enumerate(dv_scales)]
x0_scales = [scl for scl, size in zip(dv_scales, dv_size) for _ in range(size)]
x0 = [x / scl for x, scl in zip(x0, x0_scales)]

# scale accuracy
obj = project.config["OPT_OBJECTIVE"]
Expand Down Expand Up @@ -358,7 +362,8 @@ def scipy_powell(project, x0=None, xb=None, its=100, accu=1e-10, grads=False):
func = obj_f

# number of design variables
n_dv = len(project.config["DEFINITION_DV"]["KIND"])
dv_size = project.config["DEFINITION_DV"]["SIZE"]
n_dv = sum(dv_size)
project.n_dv = n_dv

# Initial guess
Expand All @@ -367,7 +372,8 @@ def scipy_powell(project, x0=None, xb=None, its=100, accu=1e-10, grads=False):

# prescale x0
dv_scales = project.config["DEFINITION_DV"]["SCALE"]
x0 = [x0[i] / dv_scl for i, dv_scl in enumerate(dv_scales)]
x0_scales = [scl for scl, size in zip(dv_scales, dv_size) for _ in range(size)]
x0 = [x / scl for x, scl in zip(x0, x0_scales)]

# scale accuracy
obj = project.config["OPT_OBJECTIVE"]
Expand Down