Open dangthatsright opened 6 years ago
There is difference between an equality constraint f(x) == a
from inequality constraint a <= f(x) <= a
. In the former case, It is treated by the solver as one equality constraint, the latter case is treated by the solver as two inequality constraint a <= f(x) <= infinity
and -infinity <= f(x) <= a
. The solver tries to solve the nonlinear nonconvex problem iteratively. In each iteration, it needs to determine which constraint shall be active (by active I mean to take equality). For an equality constraint, it is always active; for inequality constraint, there is some additional numerical procedure to determine whether to activate the inequality constraint. Due to the difference in treating equality and inequality constraint, in each iteration the result can be very different, and thus leading to the different result in the end of the optimization.
The gist is to always use equality constraint f(x) == a
instead of two inequality constraint a <= f(x) <= a
.
Hey Hongkai, agreed, but the issue is that two inequality constraints works for this problem, while an equality constraint gives a non-sensible answer... that's the confusing part.
On Mon, Apr 9, 2018 at 5:12 PM, Hongkai Dai notifications@github.com wrote:
There is difference between an equality constraint f(x) == a from inequality constraint a <= f(x) <= a. In the former case, It is treated by the solver as one equality constraint, the latter case is treated by the solver as two inequality constraint a <= f(x) <= infinity and -infinity <= f(x) <= a. The solver tries to solve the nonlinear nonconvex problem iteratively. In each iteration, it needs to determine which constraint shall be active (by active I mean to take equality). For an equality constraint, it is always active; for inequality constraint, there is some additional numerical procedure to determine whether to activate the inequality constraint. Due to the difference in treating equality and inequality constraint, in each iteration the result can be very different, and thus leading to the different result in the end of the optimization.
The gist is to always use equality constraint f(x) == a instead of two inequality constraint a <= f(x) <= a.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/RobotLocomotion/drake/issues/8556#issuecomment-379895597, or mute the thread https://github.com/notifications/unsubscribe-auth/AFYQqASwiMLAY8qg5AVZhH1M4exKxJTdks5tm86pgaJpZM4TNN5Y .
Which solver is used? SNOPT or IPOPT?
SNOPT
On Mon, Apr 9, 2018 at 5:36 PM, Hongkai Dai notifications@github.com wrote:
Which solver is used? SNOPT or IPOPT?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/RobotLocomotion/drake/issues/8556#issuecomment-379901712, or mute the thread https://github.com/notifications/unsubscribe-auth/AFYQqDfH9wXKJ7SIgC6NSXwmE0GnM_Zzks5tm9RVgaJpZM4TNN5Y .
I edited this comment so that it didn't contain any answers to this week's problem set.
@hongkai-dai At some point could you investigate and see if this is a defect in Drake?
Hi, I am in Russ' underactuated robotics class and I was told I should post this here.
In our problem set, we are simulating a system with two worlds and a rocket. I specify an initial condition and impose an end condition. This code uses direct transcription to find a valid path.
rocket = OrbitalTransferRocket()
x0 = np.array([-2., 0.1, -0.1, 3]) minimum_time = 5. maximum_time = 15. traj, u_traj, time_array = rocket.compute_trajectory_to_other_world(x0, minimum_time, maximum_time) print u_traj
mp.AddConstraint(sim_next_state[2] >= state_over_time[i,2]) mp.AddConstraint(sim_next_state[2] <= state_over_time[i,2])
mp.AddConstraint(sim_next_state[2] == state_over_time[i,2])