Expected zero and got non-zero optimisation result using CppAD with IPOPT #110
Replies: 3 comments
-
It seems from your description above that the objective function does not depend on any of the variables ? |
Beta Was this translation helpful? Give feedback.
-
@bradbell Thank you for your response. Yes, here the defined objective function is just zero and does not depend on any variable. This is just a test case of IPOPT solver in our project. With my knowledge, in this case, the acceleration |
Beta Was this translation helpful? Give feedback.
-
If the objective does not depend on the variables, any value of the variables is optimal and one has no reason to expect a particular value. It sees from your description that you want a sort of prior on the acceleration so that, given not other data, the acceleration would be zero. Perhaps something like adding a small factor times the 2-norm of the acceleration to the objective. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am using CppAD and IPOPT to solve a optimization problem. I tested this solver with a simple example as follows:
i. I define a system of robot motion like:$v[i + 1] = v[i] + a[i] * dt$ .$v[0] = 20, a[0] = 0$ .$fg[0] = 0$ .
ii. let
iii. define the objective function
The vars and fgs are defined well, and the problem is solved.
I got the solution, but it is not same as expected. I thought that all the$a[i]$ should be zero, and $v[i]$ keep the initial value, because no objective function is considered, however the solution is :
v = 20, 18.0975, 16.376, 14.8183, 13.4087, 12.1332, 10.979, 9.93466, 8.98963, 8.1345, 7.36071, 6.66052, 6.02694, 5.45363, 4.93486, 4.46543, 4.04066, 3.6563, 3.30849, 2.99378, 2.709, 2.45131, 2.21813, 2.00713, 1.81621, 1.64345, 1.48712, 1.34566, 1.21766, 1.10184, 0.997035, 0.9022, 0.816387, 0.738739, 0.668477, 0.604901, 0.547373, 0.495319, 0.448219, 0.4056, 0.367038, 0.332146, 0.300575, 0.27201, 0.246166, 0.222782, 0.201627, 0.182488, 0.165174, 0.149512, 0.135344, 0.122531, 0.110942, 0.100463, 0.0909885, 0.0824239, 0.0746836, 0.0676901, 0.0613735, 0.0556706, 0.0505245, 0.0458835, 0.0417015, 0.0379364, 0.0345507, 0.0315105, 0.0287854, 0.0263482, 0.0241744, 0.0222424, 0.0205328, 0.0190285, 0.0177146, 0.0165777, 0.0156067, 0.0147917, 0.0141246, 0.0135988, 0.013209, 0.0129512, 0.012823 .......
a = 0, -19.0247, -17.2151, -15.5775, -14.0958, -12.7549, -11.5416, -10.4438, -9.4503, -8.55135, -7.73791, -7.00184, -6.3358, -5.73311, -5.18774, -4.69426, -4.24772, -3.84365, -3.47803, -3.14718, -2.8478, -2.5769, -2.33177, -2.10996, -1.90924, -1.72762, -1.56328, -1.41457, -1.28, -1.15823, -1.04805, -0.948346, -0.858126, -0.776487, -0.702613, -0.635766, -0.575276, -0.520538, -0.471006, -0.426184, -0.385624, -0.348921, -0.315706, -0.285649, -0.258448, -0.233831, -0.211553, -0.19139, -0.173141, -0.156624, -0.141673, -0.128138, -0.115885, -0.104791, -0.0947446, -0.0856458, -0.0774034, -0.069935, -0.063166, -0.0570287, -0.0514616, -0.0464092, -0.0418208, -0.0376507, -0.033857, -0.030402, -0.0272509, -0.0243724, -0.0217376, -0.0193201, -0.0170959, -0.0150426, -0.0131397, -0.0113683, -0.00971051, -0.00814984, -0.00667067, -0.00525821, -0.00389832, -0.00257743, -0.0012823 ........
This result confuses me for a long while. Is that the logical result of the solver or an error caused perhaps by my code ?
Many thanks for any hint.
Beta Was this translation helpful? Give feedback.
All reactions