Maximize the cost function?

555 views
Skip to first unread message

Minh Vo

unread,
Mar 2, 2015, 6:02:17 PM3/2/15
to ceres-...@googlegroups.com
Hi All,

I am trying to find the minimum of a cost function defined as the sum of kinetic energy minus potential energy over a period of time for the 3D position of a particle: int(0.5mv^2 - mgh, t_start, t_end). This problem arises in Lagrangian dynamics which says that given a force, the particle must travel a path that requires the least action. By discretizing the time, the final cost function is: sum(0.5*mv^2*dt - mgh*dt). 

So, one way to optimize for this cost function is to minimize the kinetic energy and maximize for the potential energy. My problem is how I can maximize a function in ceres. Since ceres automatically square the residual, I cannot do max f(x) = - min f(x). Any suggestions?

Thanks,

Sameer Agarwal

unread,
Mar 2, 2015, 6:08:51 PM3/2/15
to ceres-...@googlegroups.com
Minh,

This is not a non-linear least squares problem so you cannot use the least squares solver in ceres. You can however use the GradientProblem object to define your objective and use LBFGS to solve it.


Sameer


--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/d2d9102a-5936-45ab-9d0d-03f8f40cde67%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Minh Vo

unread,
Mar 2, 2015, 6:34:27 PM3/2/15
to ceres-...@googlegroups.com
Hi Sameer,

Thank you for the quick reply. 

Another question I have is that if I added some least square cost functions to the previous action cost, e.g. distance between points have to be close, can I somehow use both the original least square solver and this gradient problem at the same time. The problem with this gradient problem is that I have to code up the gradient myself whereas in the least square solver, I can do automatic differentiation.

Thanks,
Minh.

Sameer Agarwal

unread,
Mar 2, 2015, 6:36:15 PM3/2/15
to ceres-...@googlegroups.com
sorry you can't use the two together.
you can if you want define a autodiffed cost function object, and then use the jacobians computed by it to easily compute the gradient.

Sameer


Reply all
Reply to author
Forward
0 new messages