diff --git a/gilp/simplex.py b/gilp/simplex.py index 0d7716a..7f67947 100644 --- a/gilp/simplex.py +++ b/gilp/simplex.py @@ -303,7 +303,8 @@ def simplex_iteration(lp: LP, else: user_input = None if pivot_rule == 'manual_select': - user_input = int(input('Pick one of ' + str(entering.keys()))) + user_options = [i + 1 for i in entering.keys()] + user_input = int(input('Pick one of ' + str(user_options))) - 1 k = {'bland': min(entering.keys()), 'min_index': min(entering.keys()), 'dantzig': max(entering, key=entering.get), diff --git a/gilp/visualize.py b/gilp/visualize.py index c1e11fa..806f596 100644 --- a/gilp/visualize.py +++ b/gilp/visualize.py @@ -134,25 +134,28 @@ def plot_lp(lp: LP) -> plt.Figure: d['Obj'] = float(unique_val[i]) lbs.append(label(d)) - # Plot basic feasible solutions with their label + # Get basic feasible solutions and set axis limits pts = [np.array([x]).transpose()[0:n] for x in unique_bfs] set_axis_limits(fig, pts) - fig.add_trace(scatter(pts,'bfs',lbs)) # Plot feasible region if n == 2: fig.add_trace(polygon(pts,'region')) if n == 3: for i in range(n+m): - pts = [bfs[j][0:n,:] for j in range(len(bfs)) if i not in bases[j]] - if len(pts) > 0: - fig.add_trace(polygon(pts,'region')) + face_pts = [bfs[j][0:n,:] for j in range(len(bfs)) if i not in bases[j]] + if len(face_pts) > 0: + fig.add_trace(polygon(face_pts,'region')) # Plot constraints for i in range(m): lb = '('+str(i+n+1)+') '+equation_string(A[i],b[i][0]) fig.add_trace(equation(fig,A[i],b[i][0],'constraint',lb)) + # Plot basic feasible solutions with their label + # (Plot last so they are on the top layer for hovering) + fig.add_trace(scatter(pts,'bfs',lbs)) + return fig diff --git a/setup.py b/setup.py index f072335..a7c09c0 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="gilp", - version="0.0.1-rc-9", + version="0.0.1-rc-10", author="Henry Robbins", author_email="hwr26@cornell.edu", description="A Python package for visualizing the geometry of linear programs.",