Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
EvA2
EvA2
Commits
05a712f7
Commit
05a712f7
authored
Nov 20, 2014
by
Fabian Becker
Browse files
Implementation of the Jannlab DE
parent
9051558e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/eva2/optimization/enums/DEType.java
View file @
05a712f7
package
eva2.optimization.enums
;
public
enum
DEType
{
RandOne
,
RandTwo
,
RandToBest
,
BestOne
,
BestTwo
,
Trigonometric
,
CurrentToRand
;
RandOne
,
RandTwo
,
RandToBest
,
BestOne
,
BestTwo
,
Trigonometric
,
CurrentToRand
,
JannlabToBest
;
@Override
public
String
toString
()
{
...
...
@@ -20,6 +20,8 @@ public enum DEType {
return
this
.
name
();
case
CurrentToRand:
return
"DE/current-to-rand"
;
case
JannlabToBest:
return
"DE/JannLab/1"
;
default
:
return
this
.
name
();
}
...
...
src/eva2/optimization/strategies/DifferentialEvolution.java
View file @
05a712f7
...
...
@@ -334,7 +334,7 @@ public class DifferentialEvolution extends AbstractOptimizer implements java.io.
break
;
}
case
RandTwo:
{
// this is DE/
current-to-
rand/
1
// this is DE/rand/
2
double
[]
rndDelta
=
this
.
fetchDeltaRandom
(
population
);
double
[]
rndDelta2
=
this
.
fetchDeltaRandom
(
population
);
if
(
parents
!=
null
)
{
...
...
@@ -357,6 +357,19 @@ public class DifferentialEvolution extends AbstractOptimizer implements java.io.
}
break
;
}
case
JannlabToBest:
{
// This is x_i + F * (x_best - x_r1) + F * (x_r2 - x_r3)
AbstractEAIndividual
randomIndy
=
population
.
getRandNIndividuals
(
1
).
get
(
0
);
double
[]
rndDelta
=
this
.
fetchDeltaRandom
(
population
);
double
[]
bestDelta
=
this
.
fetchDeltaBest
(
population
,
(
InterfaceDataTypeDouble
)
randomIndy
);
if
(
parents
!=
null
)
{
parents
.
add
(
population
.
getEAIndividual
(
parentIndex
));
}
// Add wherever oX is used directly
for
(
int
i
=
0
;
i
<
oX
.
length
;
i
++)
{
vX
[
i
]
=
oX
[
i
]
+
this
.
getCurrentF
()
*
bestDelta
[
i
]
+
this
.
getCurrentF
()
*
rndDelta
[
i
];
}
break
;
}
case
BestOne:
{
// DE/best/1
AbstractEAIndividual
bestIndy
=
getBestIndy
(
population
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment