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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Math
2e-annee
tp-math
Commits
4c8f325b
Commit
4c8f325b
authored
2 years ago
by
juliano.souzaluz
Browse files
Options
Downloads
Patches
Plain Diff
Update Main.java
parent
1acf10c8
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Main.java
+10
-8
10 additions, 8 deletions
src/Main.java
with
10 additions
and
8 deletions
src/Main.java
+
10
−
8
View file @
4c8f325b
...
@@ -8,10 +8,11 @@ public class Main {
...
@@ -8,10 +8,11 @@ public class Main {
/**
/**
* Compter le nombre de variables S.C
* Compter le nombre de variables S.C
*
* @param sc scanner
* @param sc scanner
* @return le nombre de variables S.C
* @return le nombre de variables S.C
*/
*/
private
static
Integer
nb
Variables
(
Scanner
sc
)
{
private
static
Integer
nb
Sc
(
Scanner
sc
)
{
int
count
=
0
;
int
count
=
0
;
while
(
sc
.
hasNextLine
())
{
while
(
sc
.
hasNextLine
())
{
count
++;
count
++;
...
@@ -19,8 +20,10 @@ public class Main {
...
@@ -19,8 +20,10 @@ public class Main {
}
}
return
count
-
1
;
// A cause de la premiere ligne
return
count
-
1
;
// A cause de la premiere ligne
}
}
/**
/**
* Compter le nombre d'inéquations S.C
* Compter le nombre d'inéquations S.C
*
* @param sc scanner
* @param sc scanner
* @return le nombre d'inéquations S.C
* @return le nombre d'inéquations S.C
*/
*/
...
@@ -32,6 +35,7 @@ public class Main {
...
@@ -32,6 +35,7 @@ public class Main {
/**
/**
* Fonction main
* Fonction main
*
* @param args arguments en entrées
* @param args arguments en entrées
*/
*/
public
static
void
main
(
String
[]
args
)
throws
FileNotFoundException
,
RuntimeException
{
public
static
void
main
(
String
[]
args
)
throws
FileNotFoundException
,
RuntimeException
{
...
@@ -40,12 +44,11 @@ public class Main {
...
@@ -40,12 +44,11 @@ public class Main {
File
f
=
new
File
(
"src/inputNonAdmissible.txt"
);
File
f
=
new
File
(
"src/inputNonAdmissible.txt"
);
Scanner
sc
=
new
Scanner
(
f
);
Scanner
sc
=
new
Scanner
(
f
);
String
[]
elements
;
String
[]
elements
;
int
widthMat
=
nbVariables
(
sc
)
;
int
sousCondition
=
nbSc
(
sc
),
line
=
0
;
sc
=
new
Scanner
(
f
);
// remettre le scanner à la première ligne
sc
=
new
Scanner
(
f
);
// remettre le scanner à la première ligne
int
contraintes
=
nbContraintes
(
sc
);
int
contraintes
=
nbContraintes
(
sc
);
sc
=
new
Scanner
(
f
);
// remettre le scanner à la première ligne
sc
=
new
Scanner
(
f
);
// remettre le scanner à la première ligne
int
line
=
0
;
Equation
eq
=
new
Equation
(
sousCondition
*
2
,
contraintes
);
// lignes supp au cas où, il y a des "="
Equation
eq
=
new
Equation
(
widthMat
*
2
,
contraintes
);
// lignes supp au cas où, il y a des "="
// Max / Min + function obj
// Max / Min + function obj
String
firstLine
=
sc
.
nextLine
();
String
firstLine
=
sc
.
nextLine
();
...
@@ -72,7 +75,7 @@ public class Main {
...
@@ -72,7 +75,7 @@ public class Main {
eq
.
printEq
(
line
);
eq
.
printEq
(
line
);
// Tableau initial
// Tableau initial
Simplex
spx
=
new
Simplex
(
widthMat
,
line
+
1
,
line
+
3
);
Simplex
spx
=
new
Simplex
(
sousCondition
+
1
,
line
+
contraintes
,
line
+
3
);
spx
.
createSimplex
(
eq
,
contraintes
);
spx
.
createSimplex
(
eq
,
contraintes
);
spx
.
printSimplex
(
"Tableau"
);
spx
.
printSimplex
(
"Tableau"
);
...
@@ -82,8 +85,7 @@ public class Main {
...
@@ -82,8 +85,7 @@ public class Main {
spx
.
tabAux
(
phase
);
spx
.
tabAux
(
phase
);
System
.
out
.
println
(
"Tableau Auxiliaire:"
);
System
.
out
.
println
(
"Tableau Auxiliaire:"
);
System
.
out
.
println
(
Arrays
.
deepToString
(
spx
.
getTabAux
()));
System
.
out
.
println
(
Arrays
.
deepToString
(
spx
.
getTabAux
()));
}
}
else
{
else
{
spx
.
pivot
();
spx
.
pivot
();
spx
.
printSimplex
(
"pivot"
);
spx
.
printSimplex
(
"pivot"
);
}
}
...
...
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