Skip to content

Commit

Permalink
mostly cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter230655 committed Jan 5, 2025
1 parent f751f49 commit 0377639
Showing 1 changed file with 20 additions and 31 deletions.
51 changes: 20 additions & 31 deletions examples-gallery/plot_betts_10_50.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# %%
"""
Delay Equation (Göllmann, Kern, and Maurer)
===========================================
Expand Down Expand Up @@ -95,11 +96,11 @@
instance_constraints = (
x1.func(t0) - 1.0,

x2.func(t0) - initial_guess[num_nodes-1],
x3.func(t0) - initial_guess[2*num_nodes-1],
x4.func(t0) - initial_guess[3*num_nodes-1],
x5.func(t0) - initial_guess[4*num_nodes-1],
x6.func(t0) - initial_guess[5*num_nodes-1],
x2.func(t0) - x1.func(tf),
x3.func(t0) - x2.func(tf),
x4.func(t0) - x3.func(tf),
x5.func(t0) - x4.func(tf),
x6.func(t0) - x5.func(tf),

q1.func(t0) - 0.5,
q2.func(t0) - 0.5,
Expand All @@ -120,25 +121,23 @@
}

# %%
# Iterate
# -------
# Here I iterate *loop* times.
loop = 2
for i in range(loop):

prob = Problem(obj,
obj_grad,
eom,
state_symbols,
num_nodes,
interval_value,
instance_constraints= instance_constraints,
bounds=bounds,
)
# Solve the Optimization Problem
# ------------------------------

prob.add_option('max_iter', 1000)
prob = Problem(obj,
obj_grad,
eom,
state_symbols,
num_nodes,
interval_value,
instance_constraints= instance_constraints,
bounds=bounds,
)

prob.add_option('max_iter', 1000)

# Find the optimal solution.
for _ in range(1):
solution, info = prob.solve(initial_guess)
initial_guess = solution
print(info['status_msg'])
Expand All @@ -147,16 +146,6 @@
f'{(info['obj_val'] - 3.10812211)/3.10812211*100:.3f} % ')
print('\n')

instance_constraints = (
x1.func(t0) - 1.0,

x2.func(t0) - x1.func(tf),
x3.func(t0) - x2.func(tf),
x4.func(t0) - x3.func(tf),
x5.func(t0) - x4.func(tf),
x6.func(t0) - x5.func(tf),
)

# %%
# Plot the optimal state and input trajectories.
prob.plot_trajectories(solution)
Expand Down

0 comments on commit 0377639

Please sign in to comment.