sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.41k stars 475 forks source link

InteractiveLPProblem: refactor plot method #20570

Open mkoeppe opened 8 years ago

mkoeppe commented 8 years ago

This is preparation for #18805 - Add didactical implementation of tableau cutting planes to interactive_simplex_method and in fact split out from the larger patch there.

While preparing this patch, I noticed that the code in current Sage is not able to plot some LPs with irrational data (this is now #21270). The code on this ticket does not fix this; it actually has a different failure mode for this example.

CC: @pgxiao @novoselt

Component: linear programming

Author: Peijun Xiao

Branch/Commit: u/mkoeppe/interactivelpproblem__refactor_plot_method @ aa3fa4b

Issue created by migration from https://trac.sagemath.org/ticket/20570

mkoeppe commented 8 years ago

Branch: u/mkoeppe/interactivelpproblem__refactor_plot_method

mkoeppe commented 8 years ago

New commits:

2ac4760InteractiveLPProblem: Refactor plot using new methods get_plot_bounding_box and plot_objective_growth_and_solution
0416addMinor cleanup
aa3fa4bAdd testcase for plotting of irrational polygons
mkoeppe commented 8 years ago

Commit: aa3fa4b

mkoeppe commented 8 years ago

Description changed:

--- 
+++ 
@@ -1,3 +1,16 @@
 This is preparation for #18805 - `Add didactical implementation of tableau cutting planes to interactive_simplex_method`
 and in fact split out from the larger patch there.

+While preparing this patch, I noticed that the code in current Sage is not able to plot some LPs with irrational data. This appears to be due to a bug in the Sage polyhedron code for RDF data (which InteractiveLP uses when the data are not rational).
+
+```
+            sage: poly = polytopes.regular_polygon(7)
+            sage: lp, x = poly.to_linear_program(solver='InteractiveLP', return_variable=True)
+            sage: lp.set_objective(x[0] + x[1])
+            sage: b = lp.get_backend()
+            sage: P = b.interactive_lp_problem()
+            sage: p = P.plot()    ### ERROR
+            sage: p.show()
+```
+The code on this ticket does not fix this; it actually has a different failure mode for this example.
+
novoselt commented 8 years ago
comment:3

If you have found a bug in polyhedron code, please open a ticket to fix it!

mkoeppe commented 8 years ago
comment:4

Replying to @novoselt:

If you have found a bug in polyhedron code, please open a ticket to fix it!

Could be related to #18220

mkoeppe commented 8 years ago

Description changed:

--- 
+++ 
@@ -1,16 +1,6 @@
 This is preparation for #18805 - `Add didactical implementation of tableau cutting planes to interactive_simplex_method`
 and in fact split out from the larger patch there.

-While preparing this patch, I noticed that the code in current Sage is not able to plot some LPs with irrational data. This appears to be due to a bug in the Sage polyhedron code for RDF data (which InteractiveLP uses when the data are not rational).
-
-```
-            sage: poly = polytopes.regular_polygon(7)
-            sage: lp, x = poly.to_linear_program(solver='InteractiveLP', return_variable=True)
-            sage: lp.set_objective(x[0] + x[1])
-            sage: b = lp.get_backend()
-            sage: P = b.interactive_lp_problem()
-            sage: p = P.plot()    ### ERROR
-            sage: p.show()
-```
+While preparing this patch, I noticed that the code in current Sage is not able to plot some LPs with irrational data (this is now #21270).
 The code on this ticket does not fix this; it actually has a different failure mode for this example.
mkoeppe commented 8 years ago
comment:5

Replying to @novoselt:

If you have found a bug in polyhedron code, please open a ticket to fix it!

This is now #21270.