-
Notifications
You must be signed in to change notification settings - Fork 284
Interface SCIP methods missing from PySCIPOpt #1236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1487,6 +1487,9 @@ cdef extern from "scip/scip.h": | |||||
| SCIP_Longint SCIPgetNNodeLPIterations(SCIP* scip) | ||||||
| SCIP_Longint SCIPgetNStrongbranchLPIterations(SCIP* scip) | ||||||
| SCIP_Real SCIPgetPrimalDualIntegral(SCIP* scip) | ||||||
| int SCIPgetNRuns(SCIP* scip) | ||||||
| int SCIPgetNReoptRuns(SCIP* scip) | ||||||
| void SCIPaddNNodes(SCIP* scip, SCIP_Longint nnodes) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you let me know what's the use of this method? Is it to let SCIP know that there were more nodes that were hidden from it somehow?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I'm guessing it's because of sub-SCIPs, etc. In any case, perhaps adding a line to the PySCIPOpt docstring explaining this would be nice. |
||||||
|
|
||||||
| # Parameter Functions | ||||||
| SCIP_RETCODE SCIPsetBoolParam(SCIP* scip, char* name, SCIP_Bool value) | ||||||
|
|
@@ -2134,6 +2137,7 @@ cdef extern from "scip/scip_tree.h": | |||||
| SCIP_RETCODE SCIPgetNSiblings(SCIP* scip) | ||||||
| SCIP_RETCODE SCIPgetLeaves(SCIP* scip, SCIP_NODE*** leaves, int* nleaves) | ||||||
| SCIP_Longint SCIPgetNLeaves(SCIP* scip) | ||||||
| SCIP_Longint SCIPgetNNodesLeft(SCIP* scip) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| SCIP_NODE* SCIPgetBestSibling(SCIP* scip) | ||||||
| SCIP_NODE* SCIPgetBestLeaf(SCIP* scip) | ||||||
| SCIP_NODE* SCIPgetPrioChild(SCIP* scip) | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,49 @@ | ||
| import os | ||
| from helpers.utils import random_mip_1 | ||
| from json import load | ||
| import pytest | ||
|
|
||
| def test_statistics_json(): | ||
| model = random_mip_1() | ||
|
|
||
| @pytest.fixture | ||
| def optimized_model(): | ||
| model = random_mip_1(small=True) # Using small=True for speed across tests | ||
| model.optimize() | ||
| model.writeStatisticsJson("statistics.json") | ||
| return model | ||
|
|
||
|
|
||
| def test_statistics_json(optimized_model): | ||
| optimized_model.writeStatisticsJson("statistics.json") | ||
|
|
||
| with open("statistics.json", "r") as f: | ||
| data = load(f) | ||
| assert data["origprob"]["problem_name"] == "model" | ||
|
|
||
| os.remove("statistics.json") | ||
|
|
||
| def test_getPrimalDualIntegral(): | ||
| model = random_mip_1(small=True) | ||
| model.optimize() | ||
| primal_dual_integral = model.getPrimalDualIntegral() | ||
|
|
||
| def test_getPrimalDualIntegral(optimized_model): | ||
| primal_dual_integral = optimized_model.getPrimalDualIntegral() | ||
|
|
||
| assert isinstance(primal_dual_integral, float) | ||
|
|
||
|
|
||
| def test_getNRuns(optimized_model): | ||
| n_runs = optimized_model.getNRuns() | ||
|
|
||
| assert isinstance(n_runs, int) | ||
| assert n_runs >= 1 | ||
|
|
||
|
|
||
| def test_getNReoptRuns(optimized_model): | ||
| n_reopt_runs = optimized_model.getNReoptRuns() | ||
|
|
||
| assert isinstance(n_reopt_runs, int) | ||
| assert n_reopt_runs >= 0 | ||
|
|
||
|
|
||
| def test_addNNodes(optimized_model): | ||
| initial_n_nodes = optimized_model.getNTotalNodes() | ||
| optimized_model.addNNodes(5) | ||
| new_n_nodes = optimized_model.getNTotalNodes() | ||
|
|
||
| assert new_n_nodes == initial_n_nodes + 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please order this roughly in the order in which they appear in the SCIP documentation?