From 2b6d77091064d7587c5de898adc0d17f1c7f08c0 Mon Sep 17 00:00:00 2001
From: iliya <iliya.saroukhanian@etu.hesge.ch>
Date: Tue, 2 Apr 2024 18:37:08 +0200
Subject: [PATCH] fix: bug with initial condition of cycle

---
 src/simplexe.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/simplexe.py b/src/simplexe.py
index 12de09f..3ea1807 100644
--- a/src/simplexe.py
+++ b/src/simplexe.py
@@ -264,6 +264,7 @@ class Simplexe:
 ###################################################################
     # returns cheks if the current solution is feasible or not (return True if feasible)
 
+
     def __isSolutionFeasible(self):
         # we MUST have that all BASIC variables are >= 0 to have a FEASIBLE solution
         # to iterate over basic variables do:
@@ -284,7 +285,8 @@ class Simplexe:
         #     print(self.__tableau[rowId, baseColId])
         #
 
-        if np.array_equal(self.__basicVariables, self.__initBasicVariable):
+        if self.__PivotCount != 0 and np.array_equal(self.__basicVariables,
+                                                     self.__initBasicVariable):
             self.hasCycle = True
 
         if self.hasCycle:
-- 
GitLab