Opened 6 years ago
Closed 6 years ago
#14195 closed defect (fixed)
Bad error management in the CPLEX interface
Reported by: | ncohen | Owned by: | tbd |
---|---|---|---|
Priority: | major | Milestone: | sage-5.8 |
Component: | linear programming | Keywords: | |
Cc: | dcoudert, dimpase | Merged in: | sage-5.8.beta3 |
Authors: | Nathann Cohen | Reviewers: | David Coudert |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Helloooooooooooo !!!
Recently a test did not pass in generic_graph.py
when using CPLEX. And I got the same problem with a MILP I am work on, the two of them being probably related by their common use of constants with many decimals.
********************************************************************** File "/home/ncohen/.Sage/devel/sage-2/sage/graphs/generic_graph.py", line 5779: sage: for i in range(20): g = DiGraph() g.allow_multiple_edges(False) for u,v in digraphs.RandomDirectedGNP(n,RealNumber('.2')).edges(labels = False): g.add_edge(u,v,round(random(),Integer(5))) for u,v in digraphs.Circuit(n).edges(labels = False): if not g.has_edge(u,v): g.add_edge(u,v,round(random(),Integer(5))) v2 = g.traveling_salesman_problem(use_edge_labels = True) v1 = g.traveling_salesman_problem(constraint_generation = False, use_edge_labels = True) c1 = sum(map(itemgetter(Integer(2)), v1.edges())) c2 = sum(map(itemgetter(Integer(2)), v2.edges())) if c1 != c2: print "Error !",c1,c2 print "With constraint generation :",c2 print "Without constraint generation :",c1 break Exception raised: Traceback (most recent call last): File "/home/ncohen/.Sage/local/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/home/ncohen/.Sage/local/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/home/ncohen/.Sage/local/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_74[24]>", line 9, in <module> v2 = g.traveling_salesman_problem(use_edge_labels = True) File "/home/ncohen/.Sage/local/lib/python/site-packages/sage/graphs/generic_graph.py", line 5922, in traveling_salesman_problem raise ValueError("The given graph is not hamiltonian") ValueError: The given graph is not hamiltonian **********************************************************************
This is because the two variables that are currently used in Sage to detect whether the problem is unfeasible or unbounded do not actually say whether the PROBLEM has this property, but whether the "current solution" has "been checked to satisfy" this property. Hence, a difference.
This patch uses the correct variable. And the doctest pass, and my MILP which are NEVER unbounded are not unbounded either :-P
Nathann
Attachments (1)
Change History (7)
comment:1 Changed 6 years ago by
- Status changed from new to needs_review
comment:2 Changed 6 years ago by
- Component changed from PLEASE CHANGE to linear programming
comment:3 follow-up: ↓ 4 Changed 6 years ago by
- Reviewers set to David Coudert
- Status changed from needs_review to needs_info
Changed 6 years ago by
comment:4 in reply to: ↑ 3 Changed 6 years ago by
- Status changed from needs_info to needs_review
The patch is working and solves the issue. However, I don't understand why you put commas after some declarations. Is it a mistake or is it useful?
Mistake ! It has no interest that I know of, and seems to be ignored by Cython. Patch updated !
Nathann
comment:5 Changed 6 years ago by
- Status changed from needs_review to positive_review
Review updated as well! Good to go ;-)
comment:6 Changed 6 years ago by
- Merged in set to sage-5.8.beta3
- Resolution set to fixed
- Status changed from positive_review to closed
The patch is working and solves the issue. However, I don't understand why you put commas after some declarations. Is it a mistake or is it useful?