{"action":"opened","issue":{"url":"https://api.github.com/repos/ampl/mp/issues/97","repository_url":"https://api.github.com/repos/ampl/mp","labels_url":"https://api.github.com/repos/ampl/mp/issues/97/labels{/name}","comments_url":"https://api.github.com/repos/ampl/mp/issues/97/comments","events_url":"https://api.github.com/repos/ampl/mp/issues/97/events","html_url":"https://github.com/ampl/mp/issues/97","id":145793997,"number":97,"title":"More efficient representation of stochastic programming problems","user":{"login":"vitaut","id":576385,"avatar_url":"https://avatars.githubusercontent.com/u/576385?v=3","gravatar_id":"","url":"https://api.github.com/users/vitaut","html_url":"https://github.com/vitaut","followers_url":"https://api.github.com/users/vitaut/followers","following_url":"https://api.github.com/users/vitaut/following{/other_user}","gists_url":"https://api.github.com/users/vitaut/gists{/gist_id}","starred_url":"https://api.github.com/users/vitaut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitaut/subscriptions","organizations_url":"https://api.github.com/users/vitaut/orgs","repos_url":"https://api.github.com/users/vitaut/repos","events_url":"https://api.github.com/users/vitaut/events{/privacy}","received_events_url":"https://api.github.com/users/vitaut/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-04T20:25:50Z","updated_at":"2016-04-04T20:25:50Z","closed_at":null,"body":"Currently second stage subproblems are replicated for each scenario which is fine if the matrix is completely random, but not very efficient if only a small part of problem elements are random. For example, the size of the text .nl file for the [airlift problem](\r\nhttps://github.com/vitaut/splib/blob/71a60a20b0eff01d107d591b840de8842526fa61/slptestset/airlift/airlift.ampl) with the first data set is 12.4 KiB.\r\n\r\nGetting rid of scenario indexing in second-stage variables and constraints and changing the `satisfy_demand` constraint to the following reduces the .nl file size to 1.7 KiB: \r\n\r\n```ampl\r\ns.t. satisfy_demand{j in Routes}:\r\n  load[j] - capacity_out[j] + capacity_in[j] +\r\n    contracted[j] - unused[j] = random({s in Scen} Demand[j, s]);\r\n```"}}