{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/neur2sp-neural-two-stage-stochastic","title":"Neur2SP: Neural Two-Stage Stochastic Programming","arxiv_id":"2205.12006","date":"2022-05-20","proceeding":null,"authors":["Justin Dumouchelle","Rahul Patel","Elias B. Khalil","Merve Bodur"],"abstract":"Stochastic Programming is a powerful modeling framework for decision-making under uncertainty. In this work, we tackle two-stage stochastic programs (2SPs), the most widely used class of stochastic programming models. Solving 2SPs exactly requires optimizing over an expected value function that is computationally intractable. Having a mixed-integer linear program (MIP) or a nonlinear program (NLP) in the second stage further aggravates the intractability, even when specialized algorithms that exploit problem structure are employed. Finding high-quality (first-stage) solutions -- without leveraging problem structure -- can be crucial in such settings. We develop Neur2SP, a new method that approximates the expected value function via a neural network to obtain a surrogate model that can be solved more efficiently than the traditional extensive formulation approach. Neur2SP makes no assumptions about the problem structure, in particular about the second-stage problem, and can be implemented using an off-the-shelf MIP solver. Our extensive computational experiments on four benchmark 2SP problem classes with different structures (containing MIP and NLP second-stage problems) demonstrate the efficiency (time) and efficacy (solution quality) of Neur2SP. In under 1.66 seconds, Neur2SP finds high-quality solutions across all problems even as the number of scenarios increases, an ideal property that is difficult to have for traditional 2SP solution techniques. Namely, the most generic baseline method typically requires minutes to hours to find solutions of comparable quality.","url_abs":"https://arxiv.org/abs/2205.12006v2","url_pdf":"https://arxiv.org/pdf/2205.12006v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"neur2sp-neural-two-stage-stochastic","repo_url":"https://github.com/khalil-research/neur2sp","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":null},{"paper_slug":"neur2sp-neural-two-stage-stochastic","repo_url":"https://github.com/Lycle/ICNN2SP","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":null},{"paper_slug":"neur2sp-neural-two-stage-stochastic","repo_url":"https://github.com/khalil-research/neur2bilo","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"neur2sp-neural-two-stage-stochastic","repo_url":"https://github.com/khalil-research/neur2ro","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"neur2sp-neural-two-stage-stochastic","repo_url":"https://github.com/lily-x/combinatorial-rmab","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"decision-making","task_name":"Decision Making"},{"task_slug":"decision-making-under-uncertainty","task_name":"Decision Making Under Uncertainty"},{"task_slug":"two","task_name":"Vocal Bursts Valence Prediction"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2205.12006","atlas_url":"https://app.syntology.ai/?focus=2205.12006","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2205.12006"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"deterministic:regex_extraction","url":"https://github.com/khalil-research/Neur2SP","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Lycle/ICNN2SP","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lily-x/combinatorial-rmab","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/khalil-research/neur2bilo","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/khalil-research/neur2sp","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/khalil-research/neur2ro","reach":{"status":"ok"}}],"summary":{"ran":3,"ran_fixture":2,"unverified":5},"by_repo_kind":{"official":{"samples":5,"ran":2,"repositories":1},"listed":{"samples":5,"ran":3,"repositories":2}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":10,"samples":[{"code_sha256_prefix":"8ad99dca43244bf8","entry":"ICNNExpected","repo":"Lycle/ICNN2SP","repo_kind":"listed","path":"nsp/models/pytorch_model.py","file_url":"https://github.com/Lycle/ICNN2SP/blob/HEAD/nsp/models/pytorch_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8ad99dca43244bf8"}},{"code_sha256_prefix":"cb36752969868b55","entry":"LossFunction","repo":"Lycle/ICNN2SP","repo_kind":"listed","path":"nsp/models/pytorch_model.py","file_url":"https://github.com/Lycle/ICNN2SP/blob/HEAD/nsp/models/pytorch_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cb36752969868b55"}},{"code_sha256_prefix":"2ae6b6bd81f551f4","entry":"SetInstanceEncodingNetwork","repo":"khalil-research/neur2bilo","repo_kind":"listed","path":"blo/models/models.py","file_url":"https://github.com/khalil-research/neur2bilo/blob/HEAD/blo/models/models.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2ae6b6bd81f551f4"}},{"code_sha256_prefix":"fbd59d0d6ff55995","entry":"get_nn_e_function_call","repo":"khalil-research/Neur2SP","repo_kind":"official","path":"runner.py","file_url":"https://github.com/khalil-research/Neur2SP/blob/HEAD/runner.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"DEP_MISSING","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fbd59d0d6ff55995"}},{"code_sha256_prefix":"4434e1b767639860","entry":"get_nn_p_function_call","repo":"khalil-research/Neur2SP","repo_kind":"official","path":"runner.py","file_url":"https://github.com/khalil-research/Neur2SP/blob/HEAD/runner.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"DEP_MISSING","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4434e1b767639860"}},{"code_sha256_prefix":"da274afd52fa3cc1","entry":"ICNNExpectedModel","repo":"Lycle/ICNN2SP","repo_kind":"listed","path":"nsp/models/pytorch_model.py","file_url":"https://github.com/Lycle/ICNN2SP/blob/HEAD/nsp/models/pytorch_model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"da274afd52fa3cc1"}},{"code_sha256_prefix":"57521b4f46b20b71","entry":"Model","repo":"Lycle/ICNN2SP","repo_kind":"listed","path":"nsp/models/pytorch_model.py","file_url":"https://github.com/Lycle/ICNN2SP/blob/HEAD/nsp/models/pytorch_model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"57521b4f46b20b71"}},{"code_sha256_prefix":"7226b6dce8698f76","entry":"ReLUNetworkPerScenario","repo":"khalil-research/neur2sp","repo_kind":"official","path":"nsp/models/pytorch_model.py","file_url":"https://github.com/khalil-research/neur2sp/blob/HEAD/nsp/models/pytorch_model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7226b6dce8698f76"}},{"code_sha256_prefix":"0d2a0ec787332480","entry":"ReLUNetworkPerScenarioModel","repo":"khalil-research/neur2sp","repo_kind":"official","path":"nsp/models/pytorch_model.py","file_url":"https://github.com/khalil-research/neur2sp/blob/HEAD/nsp/models/pytorch_model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"0d2a0ec787332480"}},{"code_sha256_prefix":"1b5536301d592aac","entry":"get_scenario_and_test_sets","repo":"khalil-research/Neur2SP","repo_kind":"official","path":"runner.py","file_url":"https://github.com/khalil-research/Neur2SP/blob/HEAD/runner.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1b5536301d592aac"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}