Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion ext/JuMPModels/bioreactor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ function OptimalControlProblems.bioreactor(
)

# objective
@objective(model, Max, 0.5 * Δt * sum(dc[k] + dc[k - 1] for k in 1:N))
@objective(model, Min, -0.5 * Δt * sum(dc[k] + dc[k - 1] for k in 1:N))

return model
end


2 changes: 1 addition & 1 deletion ext/JuMPModels/glider.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function OptimalControlProblems.glider(
)

# objective
@objective(model, Max, x[N])
@objective(model, Min, -x[N])

return model
end
2 changes: 1 addition & 1 deletion ext/JuMPModels/insurance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function OptimalControlProblems.insurance(
)

# objective
@objective(model, Max, 0.5 * Δt * sum(dc[i] + dc[i - 1] for i in 1:N))
@objective(model, Min, -0.5 * Δt * sum(dc[i] + dc[i - 1] for i in 1:N))

return model
end
2 changes: 1 addition & 1 deletion ext/JuMPModels/jackson.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function OptimalControlProblems.jackson(
)

# objective
@objective(model, Max, x₃[N])
@objective(model, Min, -x₃[N])

return model
end
2 changes: 1 addition & 1 deletion ext/JuMPModels/rocket.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function OptimalControlProblems.rocket(
)

# objective
@objective(model, Max, h[N])
@objective(model, Min, -h[N])

return model
end
2 changes: 1 addition & 1 deletion ext/JuMPModels/space_shuttle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ function OptimalControlProblems.space_shuttle(
end
)

@objective(model, Max, θ[N])
@objective(model, Min, -θ[N])

return model
end
2 changes: 1 addition & 1 deletion ext/MetaData/steering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ steering_meta = OrderedDict(
x₃_tf=45,
x₄_tf=0,
),
)
)
2 changes: 1 addition & 1 deletion ext/OptimalControlModels/bioreactor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function OptimalControlProblems.bioreactor(
(μ2 - u(t) * β) * b(t),
]

∫(μ2 * b(t) / (β + c)) → max
-∫(μ2 * b(t) / (β + c)) → min
end

# METHANE PROBLEM
Expand Down
2 changes: 1 addition & 1 deletion ext/OptimalControlModels/glider.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function OptimalControlProblems.glider(
ż(t) == dynamics(x(t), vx(t), vy(t), cL(t))

# objective
x(tf) → max
-x(tf) → min
end

function dynamics(x, vx, vy, cL)
Expand Down
2 changes: 1 addition & 1 deletion ext/OptimalControlModels/insurance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function OptimalControlProblems.insurance(
ẋ(t) == [(1 - γ * (t - t0) * vprime / dUdR(t)) * h(t), h(t), (1 + σ) * I(t) * fx]

# objective
∫(U(t) * fx) → max
-∫(U(t) * fx) → min
end

# initial guess
Expand Down
2 changes: 1 addition & 1 deletion ext/OptimalControlModels/jackson.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function OptimalControlProblems.jackson(
(1 - u(t)) * k3 * b(t),
]

x[3](tf) → max
-x[3](tf) → min
end

# initial guess
Expand Down
2 changes: 1 addition & 1 deletion ext/OptimalControlModels/rocket.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function OptimalControlProblems.rocket(
ẋ(t) == dynamics(h(t), v(t), m(t), T(t))

# objective
h(tf) → max
-h(tf) → min
end

# dynamics
Expand Down
2 changes: 1 addition & 1 deletion ext/OptimalControlModels/space_shuttle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function OptimalControlProblems.space_shuttle(
ẋ(t) == dynamics(x(t), u(t))

# objective
θ(tf) → max
-θ(tf) → min
end

# dynamics
Expand Down
2 changes: 1 addition & 1 deletion ext/OptimalControlModels/steering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ function OptimalControlProblems.steering(
)

return docp
end
end
2 changes: 1 addition & 1 deletion ext/OptimalControlModels_s/glider_s.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function OptimalControlProblems.glider_s(
∂(vy)(t) == (L * vx(t) - D * w) / (m * v) - g

# objective
x(tf) → max
-x(tf) → min
end

# initial guess
Expand Down
2 changes: 1 addition & 1 deletion ext/OptimalControlModels_s/insurance_s.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function OptimalControlProblems.insurance_s(
∂(x₃)(t) == (1 + σ) * I(t) * fx

# objective
∫(U(t) * fx) → max
-∫(U(t) * fx) → min
end

# initial guess
Expand Down
2 changes: 1 addition & 1 deletion ext/OptimalControlModels_s/jackson_s.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function OptimalControlProblems.jackson_s(
∂(x₂)(t) == u(t) * (k1 * a(t) - k2 * b(t)) - (1 - u(t)) * k3 * b(t)
∂(x₃)(t) == (1 - u(t)) * k3 * b(t)

x₃(tf) → max
-x₃(tf) → min
end

# initial guess
Expand Down
2 changes: 1 addition & 1 deletion ext/OptimalControlModels_s/rocket_s.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function OptimalControlProblems.rocket_s(
∂(m)(t) == -T(t) / c

# objective
h(tf) → max
-h(tf) → min
end

# initial guess
Expand Down
2 changes: 1 addition & 1 deletion ext/OptimalControlModels_s/space_shuttle_s.jl
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function OptimalControlProblems.space_shuttle_s(
(v / (r * cos(θ(t)))) * cos(γ(t)) * sin(ψ(t)) * sin(θ(t))

# objective
θ(tf) → max
-θ(tf) → min
end

# initial guess: linear interpolation for h, v, gamma (NB. t0 = 0), constant for the rest
Expand Down
2 changes: 1 addition & 1 deletion ext/OptimalControlModels_s/steering_s.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ function OptimalControlProblems.steering_s(
)

return docp
end
end
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ problems_to_exclude = [
:insurance,
:robot,
:space_shuttle,
:steering,
]
list_of_problems = setdiff(list_of_problems, problems_to_exclude)

Expand Down
Loading