Functions | |
def | cb (it) |
Variables | |
x1 | |
x2 | |
p = cs.SX.sym("p") | |
tuple | f_expr = (1 - x1) ** 2 + p * (x2 - x1 ** 2) ** 2 |
g_expr | |
x = cs.vertcat(x1, x2) | |
f = cs.Function("f", [x, p], [f_expr]) | |
g = cs.Function("g", [x, p], [g_expr]) | |
prob = pa.generate_and_compile_casadi_problem(f, g) | |
lowerbound | |
upperbound | |
param | |
innersolver | |
list | iterates = [] |
solver | |
x0 = np.array([0.1, 1.8]) | |
y0 = np.zeros((prob.m,)) | |
x_sol | |
y_sol | |
stats | |
cost_function_v = np.vectorize(prob.f, signature='(n)->()') | |
constraint_g_v = np.vectorize(prob.g, signature='(n)->(m)') | |
y = np.linspace(-0.5, 2.5, 256) | |
X | |
Y | |
XY = np.vstack([[X], [Y]]).T | |
figsize | |
Zf = cost_function_v(XY).T | |
Zg = constraint_g_v(XY) | |
Zgc = Zg[:,:,0].T | |
Zgl = Zg[:,:,1].T | |
list | fx = [patheffects.withTickedStroke(spacing=7, linewidth=0.8)] |
cgc = plt.contour(X, Y, Zgc, [0], colors='black', linewidths=0.8, linestyles='-') | |
collections | |
path_effects | |
cgl = plt.contour(X, Y, Zgl, [0], colors='black', linewidths=0.8, linestyles='-') | |
xl = plt.contour(X, Y, -X, [-prob.C.lowerbound[0]], colors='black', linewidths=0.8, linestyles='-') | |
xy = np.array(iterates) | |
markersize | |
linewidth | |
fillstyle | |
def rosenbrock.cb | ( | it | ) |
Definition at line 56 of file rosenbrock.py.
x1 |
Definition at line 9 of file rosenbrock.py.
x2 |
Definition at line 9 of file rosenbrock.py.
p = cs.SX.sym("p") |
Definition at line 11 of file rosenbrock.py.
g_expr |
Definition at line 15 of file rosenbrock.py.
Definition at line 21 of file rosenbrock.py.
Definition at line 23 of file rosenbrock.py.
Definition at line 24 of file rosenbrock.py.
Definition at line 30 of file rosenbrock.py.
lowerbound |
Definition at line 34 of file rosenbrock.py.
upperbound |
Definition at line 35 of file rosenbrock.py.
param |
Definition at line 40 of file rosenbrock.py.
innersolver |
Definition at line 43 of file rosenbrock.py.
list iterates = [] |
Definition at line 55 of file rosenbrock.py.
solver |
Definition at line 62 of file rosenbrock.py.
x0 = np.array([0.1, 1.8]) |
Definition at line 76 of file rosenbrock.py.
y0 = np.zeros((prob.m,)) |
Definition at line 77 of file rosenbrock.py.
x_sol |
Definition at line 80 of file rosenbrock.py.
y_sol |
Definition at line 80 of file rosenbrock.py.
stats |
Definition at line 80 of file rosenbrock.py.
cost_function_v = np.vectorize(prob.f, signature='(n)->()') |
Definition at line 95 of file rosenbrock.py.
constraint_g_v = np.vectorize(prob.g, signature='(n)->(m)') |
Definition at line 96 of file rosenbrock.py.
y = np.linspace(-0.5, 2.5, 256) |
Definition at line 99 of file rosenbrock.py.
X |
Definition at line 100 of file rosenbrock.py.
Y |
Definition at line 100 of file rosenbrock.py.
Definition at line 101 of file rosenbrock.py.
figsize |
Definition at line 103 of file rosenbrock.py.
Zf = cost_function_v(XY).T |
Definition at line 105 of file rosenbrock.py.
Zg = constraint_g_v(XY) |
Definition at line 109 of file rosenbrock.py.
Zgc = Zg[:,:,0].T |
Definition at line 110 of file rosenbrock.py.
Zgl = Zg[:,:,1].T |
Definition at line 111 of file rosenbrock.py.
list fx = [patheffects.withTickedStroke(spacing=7, linewidth=0.8)] |
Definition at line 112 of file rosenbrock.py.
Definition at line 113 of file rosenbrock.py.
collections |
Definition at line 114 of file rosenbrock.py.
path_effects |
Definition at line 114 of file rosenbrock.py.
Definition at line 115 of file rosenbrock.py.
Definition at line 117 of file rosenbrock.py.
xy = np.array(iterates) |
Definition at line 125 of file rosenbrock.py.
markersize |
Definition at line 126 of file rosenbrock.py.
linewidth |
Definition at line 126 of file rosenbrock.py.
fillstyle |
Definition at line 127 of file rosenbrock.py.