Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tp-math
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
Math
2e-annee
tp-math
Commits
db0368c0
Commit
db0368c0
authored
2 years ago
by
juliano.souzaluz
Browse files
Options
Downloads
Patches
Plain Diff
Update Simplex.java
parent
293e49d1
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Simplex.java
+17
-12
17 additions, 12 deletions
src/Simplex.java
with
17 additions
and
12 deletions
src/Simplex.java
+
17
−
12
View file @
db0368c0
...
...
@@ -69,36 +69,41 @@ public class Simplex {
void
tabAux
(
int
line
)
{
double
[]
tabRes
=
new
double
[
this
.
y
+
this
.
nbSousCondition
+
1
];
Arrays
.
fill
(
tabRes
,
1.0
);
for
(
int
j
=
0
;
j
<
this
.
y
;
j
++)
{
if
(
this
.
matEcart
.
getData
(
line
,
j
)
!=
0.0
)
{
double
res
=
this
.
matEcart
.
getData
(
line
,
j
)
*
-
1
;
this
.
matEcart
.
setData
(
line
,
j
,
res
);
for
(
int
i
=
0
;
i
<
this
.
x
;
i
++)
{
for
(
int
j
=
0
;
j
<
this
.
y
;
j
++)
{
double
data
=
this
.
matEcart
.
getData
(
this
.
x
,
j
);
if
(
data
<
0
)
{
System
.
out
.
println
(
data
);
}
}
}
for
(
int
j
=
0
;
j
<
this
.
y
;
j
++)
{
double
tmpSum
=
0
;
for
(
int
i
=
0
;
i
<
this
.
x
;
i
++)
{
tmpSum
+=
-
1
*
this
.
matEcart
.
getData
(
i
,
j
);
}
tabRes
[
j
]
=
tmpSum
;
}
System
.
out
.
println
();
// -2 car => tabRes[(tabRes.length-1) - (this.nbSousCondition - 1)];
tabRes
[
tabRes
.
length
-
1
]
=
tabRes
[
tabRes
.
length
-
this
.
nbSousCondition
-
2
];
tabRes
[
tabRes
.
length
-
this
.
nbSousCondition
-
2
]
=
0
;
for
(
int
i
=
0
;
i
<
this
.
tabAux
.
getX
();
i
++)
{
for
(
int
j
=
0
;
j
<
this
.
tabAux
.
getY
();
j
++)
{
if
(
i
<
this
.
matEcart
.
getX
()
&&
j
<
this
.
matEcart
.
getY
())
if
(
i
<
this
.
matEcart
.
getX
()
&&
j
<
this
.
matEcart
.
getY
())
{
this
.
tabAux
.
setData
(
i
,
j
,
this
.
matEcart
.
getData
(
i
,
j
));
else
if
(
i
==
this
.
tabAux
.
getX
()
-
1
)
}
else
if
(
i
==
this
.
tabAux
.
getX
()
-
1
)
{
this
.
tabAux
.
setData
(
i
,
j
,
tabRes
[
j
]);
else
// membre de droite à la fin du tab
}
else
// membre de droite à la fin du tab
{
this
.
tabAux
.
setData
(
i
,
j
,
this
.
matEcart
.
getData
(
i
,
j
-
this
.
matEcart
.
getX
()));
}
}
System
.
out
.
println
();
}
this
.
tabAux
.
printTabAux
(
"Tableau auxiliaire"
,
this
.
nbContraintes
,
this
.
nbSousCondition
,
this
.
tabAux
.
getY
()
-
this
.
matEcart
.
getY
()
-
1
);
pivot
(
this
.
tabAux
);
//
pivot(this.tabAux);
double
solutionOptimale
=
this
.
tabAux
.
getData
(
this
.
tabAux
.
getX
()
-
1
,
this
.
tabAux
.
getY
()
-
1
);
if
(
solutionOptimale
>
0
+
EPSILON
)
{
System
.
out
.
println
(
"Il n'y a pas de solutions admissibles pour ce problème."
);
...
...
@@ -110,7 +115,7 @@ public class Simplex {
res
.
matrixFill
(
res
.
getX
(),
res
.
getY
(),
tabAux
.
getDatas
());
res
.
matrixPrint
(
"Petit tableau"
,
2
);
nbPivot
=
0
;
pivot
(
res
);
//
pivot(res);
res
.
matrixPrint
(
"Résultat "
,
3
);
System
.
out
.
println
(
"Nombre de pivot : "
+
nbPivot
);
}
...
...
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