Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Maxime POULAIN
OAD - TP2
Commits
1fe46aac
Commit
1fe46aac
authored
Nov 05, 2021
by
Maxime
Browse files
fix infinit loop
parent
adb9aefe
Changes
6
Hide whitespace changes
Inline
Side-by-side
Code/.vs/Optimisation/v16/ipch/AutoPCH/3b104b87a075d561/SOLUTION.ipch
View file @
1fe46aac
No preview for this file type
Code/JobShop/cours.txt
View file @
1fe46aac
3 3
-1
3 3
0 10 1 4 2 5
1 5 0 2 2 10
2 10 1 3 0 10
\ No newline at end of file
Code/JobShop/main.cpp
View file @
1fe46aac
...
...
@@ -13,7 +13,7 @@ int main() {
srand
(
21058465
);
t_graphe
graph
;
graph
=
gestionGraph
::
lecture_fichier
(
"
ft06
.txt"
);
graph
=
gestionGraph
::
lecture_fichier
(
"
cours
.txt"
);
solution_t
sol
;
bierwirth
v
=
bierwirth_t
::
generateVector
(
graph
.
nb_pieces
,
graph
.
nb_machines
);
...
...
Code/JobShop/solution.cpp
View file @
1fe46aac
...
...
@@ -213,7 +213,8 @@ void solution::grasp(solution_t* sol, t_graph graphe)
int
nb_it
=
0
;
int
count
;
int
size
=
graphe
.
nb_machines
*
graphe
.
nb_pieces
;
bool
needToStop
=
false
;
int
needToStopCount
;
int
hash
[
HASH_SIZE
];
for
(
int
i
=
0
;
i
<
HASH_SIZE
;
i
++
)
...
...
@@ -222,10 +223,13 @@ void solution::grasp(solution_t* sol, t_graph graphe)
}
while
((
nb_it
<
MAX_IT
)
&&
(
sol
->
cost
!=
graphe
.
supposedBestSolution
))
while
((
nb_it
<
MAX_IT
)
&&
(
sol
->
cost
!=
graphe
.
supposedBestSolution
)
&&
!
needToStop
)
{
nb_neighbours
=
0
;
count
=
0
;
needToStop
=
false
;
needToStopCount
=
0
;
best_neighbour
.
cost
=
INT_FAST32_MAX
;
do
...
...
@@ -233,13 +237,18 @@ void solution::grasp(solution_t* sol, t_graph graphe)
v
=
bierwirth_t
::
generateVector
(
graphe
.
nb_pieces
,
graphe
.
nb_machines
);
new_solution
=
solution
::
rechercheLocale
(
v
,
graphe
,
1000
);
new_solution
.
v
=
v
;
}
while
(
sameH
(
new_solution
,
hash
,
HASH_SIZE
));
needToStopCount
++
;
if
(
needToStopCount
==
MAX_COUNT_HASH
)
{
needToStop
=
true
;
}
}
while
(
sameH
(
new_solution
,
hash
,
HASH_SIZE
)
&&
!
needToStop
);
while
(
nb_neighbours
<
MAX_NEIGHBOURS
&&
count
<
MAX_COUNT
&&
nb_neighbours
<
1
)
{
new_solution
=
genNeighbour
(
new_solution
.
v
,
size
,
graphe
.
nb_pieces
,
graphe
.
nb_machines
);
v
=
new_solution
.
v
;
new_solution
=
solution
::
rechercheLocale
(
v
,
graphe
,
1000
);
new_solution
.
v
=
v
;
if
(
sameH
(
new_solution
,
hash
,
HASH_SIZE
)
==
0
)
//s'ils ont un hash diffrent
...
...
Code/JobShop/solution.h
View file @
1fe46aac
...
...
@@ -13,6 +13,7 @@
#define HASH_SIZE 90000
#define MAX_NEIGHBOURS 5
#define MAX_COUNT 10
#define MAX_COUNT_HASH 100
#define MAX_IT 1000
...
...
Code/JobShop/x64/Debug/solution.obj
View file @
1fe46aac
No preview for this file type
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment