Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplex
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ISC2
maths
simplex
Commits
0500da53
Verified
Commit
0500da53
authored
1 year ago
by
iliya.saroukha
Browse files
Options
Downloads
Patches
Plain Diff
fix: wrong code was used for the leaving row
parent
2b6d7709
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/simplexe.py
+28
-28
28 additions, 28 deletions
src/simplexe.py
with
28 additions
and
28 deletions
src/simplexe.py
+
28
−
28
View file @
0500da53
...
@@ -311,39 +311,39 @@ class Simplexe:
...
@@ -311,39 +311,39 @@ class Simplexe:
# rowCount = self.TableauRowCount - 2 if self.IsPhaseI else self.TableauRowCount - 1
# rowCount = self.TableauRowCount - 2 if self.IsPhaseI else self.TableauRowCount - 1
# for index in range(rowCount):
# for index in range(rowCount):
rowCount
=
self
.
TableauRowCount
-
2
if
self
.
IsPhaseI
else
\
self
.
TableauRowCount
-
1
lhs
=
self
.
__tableau
[:
rowCount
,
pivotColId
]
rhs
=
self
.
__tableau
[:
rowCount
,
-
1
]
ratios
=
rhs
/
lhs
candidates
=
np
.
where
(
ratios
>
0
,
ratios
,
np
.
inf
)
if
len
((
np
.
unique
(
candidates
)))
==
0
:
return
-
1
return
candidates
.
argmin
()
# minRatio = float('inf')
# leavingRow = -1
#
# rowCount = self.TableauRowCount - 2 if self.IsPhaseI else \
# rowCount = self.TableauRowCount - 2 if self.IsPhaseI else \
# self.TableauRowCount - 1
# self.TableauRowCount - 1
#
#
# for index in range(rowCount):
# lhs = self.__tableau[:rowCount, pivotColId]
# # Si le ration est positif
# rhs = self.__tableau[:rowCount, -1]
# if self.__tableau[index][pivotColId] > 0:
# ratio = self.__tableau[index][-1] / \
# self.__tableau[index][pivotColId]
# if ratio < minRatio:
# minRatio = ratio
# leavingRow = index
#
#
# print("leaving row :", leavingRow) # vérification ok
# ratios = rhs / lhs
#
# candidates = np.where(ratios > 0, ratios, np.inf)
#
# if len((np.unique(candidates))) == 0:
# return -1
#
#
# return leavingRow
# return candidates.argmin()
minRatio
=
float
(
'
inf
'
)
leavingRow
=
-
1
rowCount
=
self
.
TableauRowCount
-
2
if
self
.
IsPhaseI
else
\
self
.
TableauRowCount
-
1
for
index
in
range
(
rowCount
):
# Si le ration est positif
if
self
.
__tableau
[
index
][
pivotColId
]
>
0
:
ratio
=
self
.
__tableau
[
index
][
-
1
]
/
\
self
.
__tableau
[
index
][
pivotColId
]
if
ratio
<
minRatio
:
minRatio
=
ratio
leavingRow
=
index
# print("leaving row :", leavingRow) # vérification ok
return
leavingRow
def
__pivotTableau
(
self
,
pivotIDs
):
def
__pivotTableau
(
self
,
pivotIDs
):
if
pivotIDs
is
None
or
pivotIDs
[
0
]
<
0
or
pivotIDs
[
1
]
<
0
:
if
pivotIDs
is
None
or
pivotIDs
[
0
]
<
0
or
pivotIDs
[
1
]
<
0
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment