From 9b368b476de2729570e8b0b8870a3337bc371e1c Mon Sep 17 00:00:00 2001
From: Brandon Rodriguez <brodriguez8774@gmail.com>
Date: Sat, 30 Nov 2019 02:13:40 -0500
Subject: [PATCH] Update "feasible or false" logic in "simplex" function

---
 resources/simplex/run_simplex.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/resources/simplex/run_simplex.py b/resources/simplex/run_simplex.py
index 948d3a1..0dc5028 100644
--- a/resources/simplex/run_simplex.py
+++ b/resources/simplex/run_simplex.py
@@ -54,10 +54,16 @@ class RunSimplex():
         :return: Solution found for problem | False if problem is infeasible.
         """
         # Run "Initialize-Simplex" function before we do any work.
-        self._parent.initialize()
-
-        # Our initialize calls part of this logic. So put it in a separate method to avoid unintentional recursion.
-        return self._run_simplex()
+        feasible = self._parent.initialize()
+
+        # Check if problem was found to be feasible.
+        if feasible:
+            # Is feasible. Solve problem.
+            # Our initialize calls part of this logic. So put it in a separate method to avoid unintentional recursion.
+            return self._run_simplex()
+        else:
+            # Not feasible. Return false.
+            return False
 
     def _run_simplex(self):
         """
-- 
GitLab