Skip to content

Commit 9a3cda1

Browse files
committed
ci: refine Codecov workflow
1 parent 9b38241 commit 9a3cda1

3 files changed

Lines changed: 21 additions & 27 deletions

File tree

.github/workflows/codecov.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Install dependencies
2626
run: |
2727
python -m pip install --upgrade pip
28-
pip install ".[plot,all-solvers,test]" pytest-rerunfailures
28+
pip install ".[plot,all-solvers,test]"
2929
pip install -e .
3030
3131
- name: Show project structure and installed packages
@@ -36,7 +36,7 @@ jobs:
3636
3737
- name: Run tests and generate coverage report
3838
run: |
39-
pytest --cov=benderslib --cov-report=xml --reruns 2 --reruns-delay 2
39+
pytest --cov=benderslib --cov-report=xml
4040
4141
- name: Upload coverage report
4242
uses: actions/upload-artifact@v4

examples/iis/iis_copt.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,17 @@ def make_sub_problem():
4040

4141

4242
if __name__ == '__main__':
43-
if not copt_available:
44-
print("COPT is not available.")
45-
exit(1)
43+
if copt_available:
44+
sub = make_sub_problem()
4645

47-
sub = make_sub_problem()
46+
# For simplicity, we directly use the Copt solver interface from BendersLib.
47+
# Typically, this should be wrapped in the SubProblem class like SubProblem(Copt(...)).
48+
sub_problem_solver = Copt(sub)
4849

49-
# For simplicity, we directly use the Copt solver interface from BendersLib.
50-
# Typically, this should be wrapped in the SubProblem class like SubProblem(Copt(...)).
51-
sub_problem_solver = Copt(sub)
52-
53-
sub_problem_solver.solve()
54-
print("Optimization status :", sub_problem_solver.status)
55-
iis_vars = sub_problem_solver.compute_iis()
56-
print("Variables in the IIS:", iis_vars)
50+
sub_problem_solver.solve()
51+
print("Optimization status :", sub_problem_solver.status)
52+
iis_vars = sub_problem_solver.compute_iis()
53+
print("Variables in the IIS:", iis_vars)
5754

5855
# %%
5956
#

examples/solvers/solver_copt.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,19 @@ def make_original_problem():
4141

4242

4343
if __name__ == '__main__':
44-
if not copt_available:
45-
print("COPT is not available.")
46-
exit(1)
44+
if copt_available:
45+
model, complicating_vars = make_original_problem()
46+
model_copy = model.clone()
47+
model.solve()
4748

48-
model, complicating_vars = make_original_problem()
49-
model_copy = model.clone()
50-
model.solve()
49+
BD = AnnotatedBenders(model, solver=Copt, complicating_vars=complicating_vars, benders=ClassicalBenders)
50+
BD.solve()
5151

52-
BD = AnnotatedBenders(model, solver=Copt, complicating_vars=complicating_vars, benders=ClassicalBenders)
53-
BD.solve()
52+
BD = AnnotatedBenders(model_copy, solver=Copt, complicating_vars=complicating_vars, benders=ClassicalBenders)
53+
BD.params.use_bnc = True
54+
BD.solve()
5455

55-
BD = AnnotatedBenders(model_copy, solver=Copt, complicating_vars=complicating_vars, benders=ClassicalBenders)
56-
BD.params.use_bnc = True
57-
BD.solve()
58-
59-
draw_curve(BD.result)
56+
draw_curve(BD.result)
6057

6158
# %%
6259
#

0 commit comments

Comments
 (0)