{"action":"opened","issue":{"url":"https://api.github.com/repos/RobotLocomotion/drake/issues/1157","labels_url":"https://api.github.com/repos/RobotLocomotion/drake/issues/1157/labels{/name}","comments_url":"https://api.github.com/repos/RobotLocomotion/drake/issues/1157/comments","events_url":"https://api.github.com/repos/RobotLocomotion/drake/issues/1157/events","html_url":"https://github.com/RobotLocomotion/drake/issues/1157","id":94527090,"number":1157,"title":"L1 vs L2 objective minimization using SNOPT?","user":{"login":"aespielberg","id":3598964,"avatar_url":"https://avatars.githubusercontent.com/u/3598964?v=3","gravatar_id":"","url":"https://api.github.com/users/aespielberg","html_url":"https://github.com/aespielberg","followers_url":"https://api.github.com/users/aespielberg/followers","following_url":"https://api.github.com/users/aespielberg/following{/other_user}","gists_url":"https://api.github.com/users/aespielberg/gists{/gist_id}","starred_url":"https://api.github.com/users/aespielberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aespielberg/subscriptions","organizations_url":"https://api.github.com/users/aespielberg/orgs","repos_url":"https://api.github.com/users/aespielberg/repos","events_url":"https://api.github.com/users/aespielberg/events{/privacy}","received_events_url":"https://api.github.com/users/aespielberg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-12T02:46:04Z","updated_at":"2015-07-12T02:46:04Z","closed_at":null,"body":"Hi all,\r\n\r\nI have a simple Acrobot plant model, and have been performing trajectory optimization on it, and I've been comparing the effect of L1 vs. L2 optimization on an objective.  My objective is on parameters, which I've made part of my optimization method.  I want to penalize varying the parameters too much, and for that, I'm comparing L1 and L2 regularization.\r\n\r\nRight now I am dealing with only one cost function, a final cost, which looks like this:\r\n\r\n```\r\nfunction [f, df] = parameter_regularizer(obj, T, x, params)\r\n            param_values = obj.robot.getParams();\r\n            w = obj.regularizer_weight;\r\n            f = w*norm(double(param_values) - params, 1);\r\n            df = [0, zeros(length(x), 1)', w*sign(params - double(param_values))'];\r\nend\r\n```\r\n\r\nWhat I've noticed is that L1 minimization takes MUUUUUCH longer than L2 minimization: we are talking ~300 seconds vs. ~6 seconds. and does not fully satisfy the constraints.  Even though one of my coordinates was constrainted to be 0 <= constraint_val <= 0; I found that the constraint_val was something like 0.008, where I know the standard slack is usually much much smaller.  I also watched the constrained value jump around wildly, from being nearly satisfied to suddenly jumping to something like 42.  I also noticed the following printout in my run:\r\n\r\n```\r\nWarning:   41 current point cannot be improved\r\n \r\n> In NonlinearProgram/mapSolverInfo (line 1544)\r\n  In NonlinearProgram/snopt (line 1420)\r\n  In NonlinearProgram/solve (line 973)\r\n  In DirectTrajectoryOptimization/solveTraj (line 188)\r\n  In KinematicDirtranTest/solveTraj (line 90)\r\n  In AcrobotPlantTest/swingUpTrajectoryKinematic (line 212)\r\n  In runSwingUpKinematicTest (line 6) \r\n```\r\n\r\nI know L1 minimization problems are harder than L2 minimization problems because of the fact that it's nonsmooth, and also the fact that the second derivative is basically zero everywhere - which means certain optimization methods don't have a lot of information to go off of.  However, I honestly didn't expect just adding this objective function, which has only 6 dimensions, would cause the compute time to balloon so much - and I didn't expect it to be so different from having an L2 objective or a nonexistent objective, both of which have nearly trivial compute time (~6s).\r\n\r\nLong-story short: Does SNOPT and the Drake interface to snopt have ways of improving optimization time?\r\n\r\na) Are there tools tailored to L1 minimization problems in particular, or known settings that work well for them?\r\nb) Where can I see documentation on what options I can control in SNOPT optimization calls?\r\nc) Precisely what algorithm does SNOPT use?  I noticed that there's some stochasticity sometimes between runs - where does this nondeterminism come from?  Is there a way to select between different optimization algorithms (e.g. gradient descent, trust-region, etc.)?\r\nd) Does this result make sense, that the trajectory optimization would have so much trouble with this objective?\r\n\r\n-Andy S."}}