Skip to content

Add extra args for includeconshdlr for new SCIP version #785

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

Merged
merged 9 commits into from
Feb 28, 2024

Conversation

Opt-Mucca
Copy link
Collaborator

The most recent version of SCIP is incompatible with the latest PySCIPOpt version. This fixes that by adding some new arguments to the include cons handler function.

@Opt-Mucca Opt-Mucca requested a review from mmghannam January 26, 2024 15:55
@ju-manns
Copy link
Contributor

I got the following assertion error:

18:27:07 _________________________________ test_circle __________________________________
18:27:07 
18:27:07     def test_circle():
18:27:07         points =[
18:27:07                 (2.802686, 1.398947),
18:27:07                 (4.719673, 4.792101),
18:27:07                 (1.407758, 7.769566),
18:27:07                 (2.253320, 2.373641),
18:27:07                 (8.583144, 9.769102),
18:27:07                 (3.022725, 5.470335),
18:27:07                 (5.791380, 1.214782),
18:27:07                 (8.304504, 8.196392),
18:27:07                 (9.812677, 5.284600),
18:27:07                 (9.445761, 9.541600)]
18:27:07     
18:27:07         m = Model()
18:27:07         a = m.addVar('a', lb=None)
18:27:07         b = m.addVar('b', ub=None)
18:27:07         r = m.addVar('r')
18:27:07     
18:27:07         # minimize radius
18:27:07         m.setObjective(r, 'minimize')
18:27:07     
18:27:07         for i,p in enumerate(points):
18:27:07             # NOTE: SCIP will not identify this as SOC constraints!
18:27:07             m.addCons( sqrt((a - p[0])**2 + (b - p[1])**2) <= r, name = 'point_%d'%i)
18:27:07     
18:27:07         m.optimize()
18:27:07     
18:27:07         bestsol = m.getBestSol()
18:27:07         assert abs(m.getSolVal(bestsol, r) - 5.2543) < 1.0e-3
18:27:07 >       assert abs(m.getSolVal(bestsol, a) - 6.1230) < 1.0e-3
18:27:07 E       AssertionError: assert 0.0014526025465624315 < 0.001
18:27:07 E        +  where 0.0014526025465624315 = abs((6.124452602546563 - 6.123))
18:27:07 E        +    where 6.124452602546563 = <built-in method getSolVal of pyscipopt.scip.Model object at 0x7f3eb805fee8>({'a': 6.124452602546563, 'b': 5.470086589738751, 'r': 5.254360607131121}, a)
18:27:07 E        +      where <built-in method getSolVal of pyscipopt.scip.Model object at 0x7f3eb805fee8> = <pyscipopt.scip.Model object at 0x7f3eb805fee8>.getSolVal
18:27:07 
18:27:07 tests/test_nonlinear.py:140: AssertionError

@Opt-Mucca
Copy link
Collaborator Author

@ju-manns I am confident that the test failing has nothing to do with my change. These numeric errors with the non-linear tests seem to be a frequent problem. They are especially common when you test without IPOPT enabled.
I haven't spent the time exploring them to decide if it's a Python problem that is responsible for the tolerances, if it's a problem with the underlying test and the values they compare to, or if it's simply a problem with SCIP

@Joao-Dionisio
Copy link
Member

Joao-Dionisio commented Jan 31, 2024

The assertions are passing on my end. But I don't like having the fixed 1.0e-3 there, it should be dependent on the model, I believe.

@ju-manns
Copy link
Contributor

ju-manns commented Feb 5, 2024

I discussed this with Ksenia and we decided to raise those bounds for now.

@ju-manns ju-manns force-pushed the mt/add_conshdlr_arg branch from b6ab98b to 874e9a3 Compare February 28, 2024 10:53
Copy link

codecov bot commented Feb 28, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 52.85%. Comparing base (06cb349) to head (fd85f23).

Files Patch % Lines
src/pyscipopt/conshdlr.pxi 33.33% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #785      +/-   ##
==========================================
+ Coverage   52.76%   52.85%   +0.09%     
==========================================
  Files          17       17              
  Lines        3817     3829      +12     
==========================================
+ Hits         2014     2024      +10     
- Misses       1803     1805       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mmghannam mmghannam merged commit 8848eda into master Feb 28, 2024
@Joao-Dionisio Joao-Dionisio deleted the mt/add_conshdlr_arg branch April 22, 2025 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants