Skip to content
Snippets Groups Projects
Verified Commit fd2ff86a authored by iliya.saroukha's avatar iliya.saroukha :first_quarter_moon:
Browse files

idk what happened ngl

parent 0500da53
No related branches found
No related tags found
No related merge requests found
...@@ -264,7 +264,6 @@ class Simplexe: ...@@ -264,7 +264,6 @@ class Simplexe:
################################################################### ###################################################################
# returns cheks if the current solution is feasible or not (return True if feasible) # returns cheks if the current solution is feasible or not (return True if feasible)
def __isSolutionFeasible(self): def __isSolutionFeasible(self):
# we MUST have that all BASIC variables are >= 0 to have a FEASIBLE solution # we MUST have that all BASIC variables are >= 0 to have a FEASIBLE solution
# to iterate over basic variables do: # to iterate over basic variables do:
...@@ -341,7 +340,7 @@ class Simplexe: ...@@ -341,7 +340,7 @@ class Simplexe:
minRatio = ratio minRatio = ratio
leavingRow = index leavingRow = index
# print("leaving row :", leavingRow) # vérification ok print("leaving row :", leavingRow) # vérification ok
return leavingRow return leavingRow
...@@ -393,6 +392,8 @@ class Simplexe: ...@@ -393,6 +392,8 @@ class Simplexe:
# | c | 0 | 0 | | c | 0 | 0 | 0 | # | c | 0 | 0 | | c | 0 | 0 | 0 |
# |-----------| |---------------| # |-----------| |---------------|
# | d |-1 | 0 | S | # | d |-1 | 0 | S |
print(
f"Shape = {simplexe.__tableau.shape}\t= {simplexe.__tableau}")
# d = - sum(coeff in column) and S is the -sum vector b (NOTE: we already made sure all elements in b are non-negative!) # d = - sum(coeff in column) and S is the -sum vector b (NOTE: we already made sure all elements in b are non-negative!)
# store the fact we are actually using a Phase I - to make sure we don't select a pivot in the "original" objective row! # store the fact we are actually using a Phase I - to make sure we don't select a pivot in the "original" objective row!
self.IsPhaseI = True self.IsPhaseI = True
...@@ -405,11 +406,17 @@ class Simplexe: ...@@ -405,11 +406,17 @@ class Simplexe:
tmpCopy = simplexe.__tableau.copy() tmpCopy = simplexe.__tableau.copy()
self.__tableau = tmpCopy[0:-1, 0:-1] self.__tableau = tmpCopy[0:-1, 0:-1]
# add the auxiliary variables and their objective row # add the auxiliary variables and their objective row
print(
f"Shape = {self.__tableau.shape}\tBefore appending = {self.__tableau}")
self.__tableau = np.append( self.__tableau = np.append(
self.__tableau, np.identity(simplexe.NumRows), axis=1) self.__tableau, np.identity(simplexe.NumRows), axis=1)
# add the RHS column # add the RHS column
self.__tableau = np.append( self.__tableau = np.append(
self.__tableau, np.array([tmpCopy[0:-1, -1]]).T, axis=1) self.__tableau, np.array([tmpCopy[0:-1, -1]]).T, axis=1)
print(
f"Shape = {self.__tableau.shape}\tAfter appending = {self.__tableau}")
# create the tableau for the PhaseI from above initialized arrays!!! # create the tableau for the PhaseI from above initialized arrays!!!
raise Exception('Not implemented', raise Exception('Not implemented',
'Simplexe.initPhaseI: missing code to be implemented.') 'Simplexe.initPhaseI: missing code to be implemented.')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment