Skip to content

Commit

Permalink
open source solver test
Browse files Browse the repository at this point in the history
  • Loading branch information
hdunham committed Mar 21, 2024
1 parent f114d3d commit 145bfc6
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions reoptjl/test/posts/clean_Cbc.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions reoptjl/test/posts/clean_HiGHS.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions reoptjl/test/posts/clean_SCIP.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions reoptjl/test/posts/res_Cbc.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions reoptjl/test/posts/res_HiGHS.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions reoptjl/test/posts/res_SCIP.json

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions reoptjl/test/test_job_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@

class TestJobEndpoint(ResourceTestCaseMixin, TransactionTestCase):

def test_solvers(self):
for solver in [
"HiGHS",
"Cbc",
"SCIP"]:
scenario_name = "res_{}".format(solver)
scenario_file = os.path.join('reoptjl', 'test', 'posts', '{}.json'.format(scenario_name))
scenario = json.load(open(scenario_file, 'r'))
# scenario["Settings"]["solver_name"] = solver
resp = self.api_client.post('/v3/job/', format='json', data=scenario)
r = json.loads(resp.content)
run_uuid = r.get('run_uuid')
resp = self.api_client.get(f'/v3/job/{run_uuid}/results')
r = json.loads(resp.content)
results = r["outputs"]
output_file = os.path.join('reoptjl', 'test', 'outputs', "{}_outputs.json".format(scenario_name))
json.dump(r, open(output_file, "w"))

def test_multiple_outages(self):

scenario_file = os.path.join('reoptjl', 'test', 'posts', 'outage.json')
Expand Down

0 comments on commit 145bfc6

Please sign in to comment.