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
fd2ff86a
Verified
Commit
fd2ff86a
authored
1 year ago
by
iliya.saroukha
Browse files
Options
Downloads
Patches
Plain Diff
idk what happened ngl
parent
0500da53
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
+9
-2
9 additions, 2 deletions
src/simplexe.py
with
9 additions
and
2 deletions
src/simplexe.py
+
9
−
2
View file @
fd2ff86a
...
@@ -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
}
\t
Before 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
}
\t
After 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.
'
)
...
...
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