Skip to content

Commit a926924

Browse files
Fix indexing of collocation initial guesses
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 620055b commit a926924

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

class05/class05.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,8 @@ begin
498498
@variable(cp_model, -u_max .<= u[1:N] .<= u_max, start=0)
499499

500500
# collocation points
501-
@variable(cp_model, -d_max .<= q_1_c[i=1:N-1] .<= d_max, start=(2*i + 1)/(2 * N) * d)
502-
@variable(cp_model, q_2_c[i=1:N-1], start=(2*i + 1)/(2 * N) * pi)
501+
@variable(cp_model, -d_max .<= q_1_c[i=1:N-1] .<= d_max, start=(2*i - 1)/(2 * (N - 1)) * d)
502+
@variable(cp_model, q_2_c[i=1:N-1], start=(2*i - 1)/(2 * (N - 1)) * pi)
503503
@variable(cp_model, d_q_1_c[1:N-1], start=d/T)
504504
@variable(cp_model, d_q_2_c[1:N-1], start=pi/T)
505505
@variable(cp_model, -u_max .<= u_c[1:N-1] .<= u_max, start=0)

0 commit comments

Comments
 (0)