Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ST7-Intel
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
Simon Maréchal
ST7-Intel
Commits
553fb84f
Commit
553fb84f
authored
4 years ago
by
Matthieu Oberon
Browse files
Options
Downloads
Patches
Plain Diff
fix MMAS
parent
25e82dad
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
Appli-iso3dfd/ACO.py
+4
-9
4 additions, 9 deletions
Appli-iso3dfd/ACO.py
with
4 additions
and
9 deletions
Appli-iso3dfd/ACO.py
+
4
−
9
View file @
553fb84f
...
...
@@ -103,8 +103,9 @@ def ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1_max=256, n2_max
best_p
=
paths
[
np
.
argmin
(
costs
),
:]
#we compare the best paths of all process and we save only the best one
recv_table
=
np
.
empty
(
2
)
comm
.
Allreduce
(
np
.
array
([
best_cost
,
Me
]),
recv_table
,
OP
=
MPI
.
MINLOC
)
recv_table
=
(
0.
,
0
)
send_table
=
(
best_cost
,
Me
)
recv_table
=
comm
.
allreduce
(
send_table
,
op
=
MPI
.
MINLOC
)
best_cost
=
recv_table
[
0
]
best_p
=
comm
.
bcast
(
best_p
,
root
=
recv_table
[
1
])
...
...
@@ -113,13 +114,7 @@ def ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1_max=256, n2_max
tau
=
tools
.
add_pheromones
(
tau
,
np
.
array
([
best_p
]),
np
.
array
([[
best_cost
]]),
Q
,
n1_size
,
n2_size
,
n3_size
,
n_cbx
,
n_cby
)
#verification of the threshold constraint
size
=
np
.
size
(
tau
)
for
i
in
range
(
size
[
0
]):
for
j
in
range
(
size
[
1
]):
if
tau
[
i
][
j
]
<
sub_threshold
:
tau
[
i
][
j
]
=
sub_threshold
if
tau
[
i
][
j
]
>
sup_threshold
:
tau
[
i
][
j
]
=
sup_threshold
np
.
clip
(
tau
,
sub_threshold
,
sup_threshold
)
#we update the best path on all iteration
if
best_cost
<
cost_opti
:
...
...
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