From f2711b0c58bd8415a9eca7f20d8be8cbe5fa9607 Mon Sep 17 00:00:00 2001 From: iliya <iliya.saroukhanian@etu.hesge.ch> Date: Fri, 22 Mar 2024 11:41:26 +0100 Subject: [PATCH] feasible solution --- src/simplexe.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/simplexe.py b/src/simplexe.py index 8fc5959..2247d32 100644 --- a/src/simplexe.py +++ b/src/simplexe.py @@ -253,9 +253,14 @@ class Simplexe: def __isSolutionFeasible(self): # we MUST have that all BASIC variables are >= 0 to have a FEASIBLE solution # to iterate over basic variables do: - # for rowId, baseColId in enumerate(self.__basicVariables): - raise Exception( - 'Not implemented', 'Simplexe.__isSolutionFeasible: missing code to be implemented.') + + for rowId, baseColId in enumerate(self.__basicVariables): + if self.RHS[rowId] / self.__tableau[rowId][baseColId] < 0: + return False + + # raise Exception( + # 'Not implemented', 'Simplexe.__isSolutionFeasible: missing code to be implemented.') + return True # returns index of entering col Id # return None or -1 if there is pivot -- GitLab