Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
SimAquaLife
GR3D
Commits
9eba6e7a
Commit
9eba6e7a
authored
Jul 02, 2020
by
Lambert Patrick
Browse files
typing correction
parent
ceffee55
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/species/DisperseAndMigrateToRiverWithMultiNomDistriAndDeathBasin.java
View file @
9eba6e7a
...
...
@@ -112,8 +112,7 @@ public class DisperseAndMigrateToRiverWithMultiNomDistriAndDeathBasin extends Di
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
(
new
XStream
(
new
DomDriver
())).
toXML
(
new
DisperseAndMigrateToRiverWithMultiNomDistriAndDeathBasin
()));
System
.
out
.
println
((
new
XStream
(
new
DomDriver
())).
toXML
(
new
DisperseAndMigrateToRiverWithMultiNomDistriAndDeathBasin
()));
}
...
...
@@ -166,7 +165,7 @@ public class DisperseAndMigrateToRiverWithMultiNomDistriAndDeathBasin extends Di
// influence of the fish length on the probability to disperse
if
(
strayedAmount
!=
0
)
{
// calcula the weight associated with the fish length in the probabaility to disperse
// calcula
te
the weight associated with the fish length in the probabaility to disperse
double
weightFishLength
=
-(
alpha2Rep
*
((
fish
.
getLength
()
-
meanSpawnersLengthAtRepro
)
/
standardDeviationOfSpawnersLengthAtRepro
));
...
...
@@ -176,8 +175,7 @@ public class DisperseAndMigrateToRiverWithMultiNomDistriAndDeathBasin extends Di
long
amountToGo
=
0
;
Map
<
RiverBasin
,
Double
>
basinWeightsFromDeparture
=
new
HashMap
<
RiverBasin
,
Double
>();
for
(
Entry
<
RiverBasin
,
Double
>
entry
:
basinWeightsPerBasin
.
get
(
departure
).
entrySet
())
{
double
accBasinWeight
=
1
.
/
(
1
.
+
Math
.
exp
(-(
entry
.
getValue
()
+
weightFishLength
)));
double
accBasinWeight
=
1
.
/
(
1
.
+
Math
.
exp
(-(
entry
.
getValue
()
+
weightFishLength
)));
// put weight to 0 for unused basins
if
(
group
.
isThereBasinToUpdate
())
{
...
...
@@ -195,14 +193,16 @@ public class DisperseAndMigrateToRiverWithMultiNomDistriAndDeathBasin extends Di
totalWeight
=
totalWeight
+
weightOfDeathBasin
;
// Afficher le contenu du MAP
System
.
out
.
println
(
departure
.
getName
()
+
": "
+
totalWeight
);
System
.
out
.
println
(
"strayedAmount before: "
+
strayedAmount
);
Iterator
<
RiverBasin
>
iterateur
=
basinWeightsFromDeparture
.
keySet
().
iterator
();
// Parcourir les clés et afficher les entrées de chaque clé;
while
(
iterateur
.
hasNext
())
{
RiverBasin
key
=
iterateur
.
next
();
System
.
out
.
println
(
key
.
getName
()
+
"=>"
+
basinWeightsFromDeparture
.
get
(
key
));
System
.
out
.
println
(
key
.
getName
()
+
" dist = "
+
departure
.
getNeighboursDistances
().
get
(
key
)
+
"=>"
+
(
basinWeightsFromDeparture
.
get
(
key
)));
}
System
.
out
.
println
();
// compute sequentially the prob to go into a basin
for
(
Entry
<
RiverBasin
,
Double
>
entry
:
basinWeightsPerBasin
.
get
(
departure
).
entrySet
())
{
RiverBasin
strayerDestination
=
entry
.
getKey
();
...
...
@@ -212,8 +212,8 @@ public class DisperseAndMigrateToRiverWithMultiNomDistriAndDeathBasin extends Di
// strayedAmount, probToGo);
amountToGo
=
aleaGen
.
getSuccessNumber
(
strayedAmount
,
probToGo
);
if
(
amountToGo
>
0
)
{
strayerDestination
.
addFish
(
fish
.
duplicateWithNewPositionAndAmount
(
group
.
getPilot
(),
strayerDestination
,
amountToGo
),
group
);
strayerDestination
.
addFish
(
fish
.
duplicateWithNewPositionAndAmount
(
group
.
getPilot
(),
strayerDestination
,
amountToGo
),
group
);
}
totalWeight
-=
weight
;
...
...
@@ -226,6 +226,9 @@ public class DisperseAndMigrateToRiverWithMultiNomDistriAndDeathBasin extends Di
}
}
System
.
out
.
println
(
"strayedAmount after: "
+
strayedAmount
);
System
.
out
.
println
();
// update fish with homing
if
(
homingAmount
>
0
)
{
fish
.
setAmount
(
homingAmount
);
...
...
Write
Preview
Markdown
is supported
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