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
fc94c856
Commit
fc94c856
authored
2 years ago
by
juliano.souzaluz
Browse files
Options
Downloads
Patches
Plain Diff
push
parent
db0368c0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Main.java
+1
-1
1 addition, 1 deletion
src/Main.java
src/Simplex.java
+9
-10
9 additions, 10 deletions
src/Simplex.java
with
10 additions
and
11 deletions
src/Main.java
+
1
−
1
View file @
fc94c856
...
...
@@ -44,7 +44,7 @@ public class Main {
System
.
out
.
println
(
"Entrez le nom du fichier à tester, il doit se situer dans le dossier src."
);
//String nameFile = readFile.nextLine();
String
nameFile
=
"network1.txt"
;
//String nameFile = "input
NonAdmissible
.txt";
//String nameFile = "input.txt";
File
f
=
new
File
(
"src/"
+
nameFile
);
Scanner
sc
=
new
Scanner
(
f
);
String
[]
elements
;
...
...
This diff is collapsed.
Click to expand it.
src/Simplex.java
+
9
−
10
View file @
fc94c856
...
...
@@ -67,13 +67,15 @@ public class Simplex {
}
void
tabAux
(
int
line
)
{
System
.
out
.
println
(
""
);
double
[]
tabRes
=
new
double
[
this
.
y
+
this
.
nbSousCondition
+
1
];
Arrays
.
fill
(
tabRes
,
1.0
);
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
i
=
0
;
i
<
this
.
y
;
i
++)
{
for
(
int
j
=
0
;
j
<
this
.
x
;
j
++)
{
if
(
this
.
matEcart
.
getData
(
j
,
this
.
y
-
1
)
<
0
)
{
if
(
this
.
matEcart
.
getData
(
j
,
i
)
!=
0
)
{
this
.
matEcart
.
setData
(
j
,
i
,
-
this
.
matEcart
.
getData
(
j
,
i
));
}
}
}
}
...
...
@@ -85,7 +87,6 @@ public class Simplex {
tabRes
[
j
]
=
tmpSum
;
}
// -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
;
...
...
@@ -100,10 +101,9 @@ public class Simplex {
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."
);
...
...
@@ -115,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
);
}
...
...
@@ -161,7 +161,6 @@ public class Simplex {
}
// TODO : A REFAIRE POUR SWITCH DE Y AU CAS OU
int
ligneSortante
(
Matrix
mat
,
int
y
)
{
int
id
=
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