Hello, Pulsipher, appreciate your work on InfiniteOpt. While solving the following optimal control problem
The optimal control function should be smooth. But the numerical optimal results has unsmooth points at the beginning and end.
I test many examples, it happened in most examples. Why it happens and how to deal with it?
using InfiniteOpt, Ipopt, Plots
using KNITRO
# Parmeters
# Time span
t0 = 0
tf = 1
# Initial values
x1 = 1
# Model
model = InfiniteModel(KNITRO.Optimizer)
# infinite_parameter
@infinite_parameter(model, t ∈ [t0, tf], num_supports = 101)
# variable
@variable(model, x ≥ 0, Infinite(t))
@variable(model, u, Infinite(t), start = 0)
# objective
@objective(model, Min, x(1)^2+∫(u^2, t))
# constraint
@constraint(model, x(0) == x1)
@constraint(model, x_constr, ∂(x, t) == x + u)
# Optimization
print(model)
optimize!(model)
# Visulization
ts = value(t)
u = value(u)
x = value(x)
@show plot(ts, u)
@show plot(ts, x)
Hello, Pulsipher, appreciate your work on InfiniteOpt. While solving the following optimal control problem The optimal control function should be smooth. But the numerical optimal results has unsmooth points at the beginning and end.
I test many examples, it happened in most examples. Why it happens and how to deal with it?