I have simple objective function (goal), solving with Ipopt
Min, sum (sin(data[i]*x) for i=1:length(data) )
I was just curious if there is some way/wrap to achieve :
maximize linearity of process to goal.
Like in this example obj is Min, sum - so process is simple cumsum.
Reason behind this is to work with trajectory (process), for example finding path which looks (the most) like “line”.
I tried like “distance between process’s segments”, but it doesnt seem to work in Ipopt.
(I found some math hints but too math
I tried like “distance between process’s segments”
Take a read of Please read: make it easier to help you. It’s easier to help if you can provide the code as a minimal working example.
maximize linearity of process to goal
Can you clarify what this means?
data = randn(n)
model = Model(Ipopt.Optimizer)
@variable(model, a) #max distance
y[ii=1:10], sum( sin(x*data[i]) for i = 1+floor(Int,(n/10)*ii-1):floor(Int,(n/10)*ii) ) # 10 segments y[1:10] - just cumsum
yy[ii=1:9], (-y[ii]+y[ii+1] )^2 # just abs(distance) , but ^2
@NLconstraint(model, [i=1:9],yy[i] <= a) #max distance , 10 segments=9 distances
#@NLconstraint(model, [i=1:9],yy[i] >= 2) #next to implement : slope of process, each segment must raise minimum 2)
a # minimize max distance
print( objective_value(model) )
value.(y) # currently zeros(10), but when slope added
Normaly I just min/max objective function, but in graph (y here) I observe sometimes very strange behaviours. So if graph of process looks like line, it would be very good.
I have other max objective function working with Ipopt. Sometimes value of y[i] jumps above global optimum, then went down.
From time perspective (y…y), I was curious, if there is (simplyfied ) way to ‘model’ graph.
(1) Current situation, ignoring graph, only min/max obj (newest y
(2) Better graph
*(3) Line graph
*(4) Best line graph with high obj
( * good solutions)
I still don’t really understand the problem I’m afraid. You’re picking
x that minimizes the maximum distance between two points
Ipopt assumes the problem is convex, so using a function like
sin will result in a locally optimal solution. You may see some weird artifacts. You could try multiple restarts by using
@variable(model, x, start = 1.0) for different