{"action":"created","issue":{"url":"https://api.github.com/repos/casadi/casadi/issues/1350","labels_url":"https://api.github.com/repos/casadi/casadi/issues/1350/labels{/name}","comments_url":"https://api.github.com/repos/casadi/casadi/issues/1350/comments","events_url":"https://api.github.com/repos/casadi/casadi/issues/1350/events","html_url":"https://github.com/casadi/casadi/issues/1350","id":59357278,"number":1350,"title":"Auto-init functions?","user":{"login":"jaeandersson","id":2487645,"avatar_url":"https://avatars.githubusercontent.com/u/2487645?v=3","gravatar_id":"","url":"https://api.github.com/users/jaeandersson","html_url":"https://github.com/jaeandersson","followers_url":"https://api.github.com/users/jaeandersson/followers","following_url":"https://api.github.com/users/jaeandersson/following{/other_user}","gists_url":"https://api.github.com/users/jaeandersson/gists{/gist_id}","starred_url":"https://api.github.com/users/jaeandersson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaeandersson/subscriptions","organizations_url":"https://api.github.com/users/jaeandersson/orgs","repos_url":"https://api.github.com/users/jaeandersson/repos","events_url":"https://api.github.com/users/jaeandersson/events{/privacy}","received_events_url":"https://api.github.com/users/jaeandersson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/casadi/casadi/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":20,"created_at":"2015-02-28T20:37:31Z","updated_at":"2015-05-23T00:37:20Z","closed_at":null,"body":"@mvukov suggested automatically initializing Function instances on first use. I'm not fond of that idea, but I could imagine having initialization be done as part of the constructor, by default. Then you would also need to pass options via the constructor:\r\n```python\r\nnlp = ...\r\nsolver = NlpSolver(\"ipopt\", nlp, hessian_approximation=\"limited-memory\")\r\nsolver.setInput(x0,\"x0\")\r\nsolver.setInput(lbx, \"lbx\")\r\nsolver.evaluate()\r\nxopt = solver.getOuput(\"x\")\r\nlam_x = solver.getOuput(\"lam_x\")\r\n```\r\nor, more compactly still (with shorthands for evaluation):\r\n```python\r\nnlp = ...\r\nsolver = NlpSolver(\"ipopt\", nlp, hessian_approximation=\"limited-memory\")\r\nsol = solver({\"x0\": x0, \"lbx\" : lbx})\r\nxopt, lam = [sol[i] for i in ('x', 'lam_x')]\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/casadi/casadi/issues/comments/104807255","html_url":"https://github.com/casadi/casadi/issues/1350#issuecomment-104807255","issue_url":"https://api.github.com/repos/casadi/casadi/issues/1350","id":104807255,"user":{"login":"ghorn","id":375331,"avatar_url":"https://avatars.githubusercontent.com/u/375331?v=3","gravatar_id":"","url":"https://api.github.com/users/ghorn","html_url":"https://github.com/ghorn","followers_url":"https://api.github.com/users/ghorn/followers","following_url":"https://api.github.com/users/ghorn/following{/other_user}","gists_url":"https://api.github.com/users/ghorn/gists{/gist_id}","starred_url":"https://api.github.com/users/ghorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghorn/subscriptions","organizations_url":"https://api.github.com/users/ghorn/orgs","repos_url":"https://api.github.com/users/ghorn/repos","events_url":"https://api.github.com/users/ghorn/events{/privacy}","received_events_url":"https://api.github.com/users/ghorn/received_events","type":"User","site_admin":false},"created_at":"2015-05-23T00:37:20Z","updated_at":"2015-05-23T00:37:20Z","body":"I always name my functions but I see no reason to force it on anyone else, especially when the name option is so easy to use."}}