Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
evoal-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
evoal
source
evoal-core
Commits
ce27b084
Commit
ce27b084
authored
2 years ago
by
Bernhard Johannes Berger
Browse files
Options
Downloads
Patches
Plain Diff
Made size of elite and tournament selector relative to population size. fix
#11
parent
7536f21e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#244264
passed
2 years ago
Stage: Domain Specific Languages
Stage: EvoAl
Stage: Release
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/de.evoal.core.main/src/main/java/de/evoal/core/main/ea/producer/SelectorFactory.java
+9
-6
9 additions, 6 deletions
.../java/de/evoal/core/main/ea/producer/SelectorFactory.java
with
9 additions
and
6 deletions
src/core/de.evoal.core.main/src/main/java/de/evoal/core/main/ea/producer/SelectorFactory.java
+
9
−
6
View file @
ce27b084
...
...
@@ -8,10 +8,14 @@ import io.jenetics.*;
import
javax.enterprise.context.ApplicationScoped
;
import
javax.enterprise.inject.Produces
;
import
javax.inject.Inject
;
import
javax.inject.Named
;
@ApplicationScoped
public
class
SelectorFactory
{
@Inject
@ConfigurationValue
(
entry
=
CoreBlackboardEntries
.
OPTIMISATION_CONFIGURATION
,
access
=
"algorithm.size-of-population"
)
private
int
sizeOfPopulation
;
@Produces
@Named
(
"survivor"
)
...
...
@@ -60,9 +64,9 @@ public class SelectorFactory {
return
new
TruncationSelector
<>(
worstRank
);
}
private
static
<
G
extends
Gene
<?,
G
>,
C
extends
Comparable
<?
super
C
>>
Selector
<
G
,
C
>
createTournamentSelector
(
final
Instance
config
)
{
int
sampleSize
=
LanguageHelper
.
lookup
(
config
,
"size
"
);
return
new
TournamentSelector
<>(
sampleSize
);
private
<
G
extends
Gene
<?,
G
>,
C
extends
Comparable
<?
super
C
>>
Selector
<
G
,
C
>
createTournamentSelector
(
final
Instance
config
)
{
int
count
=
(
int
)(
LanguageHelper
.
<
Double
>
lookup
(
config
,
"size
-factor"
)
*
sizeOfPopulation
);
return
new
TournamentSelector
<>(
count
);
}
private
static
<
G
extends
Gene
<?,
G
>,
C
extends
Comparable
<?
super
C
>>
Selector
<
G
,
C
>
createStochasticUniversalSelector
(
final
Instance
config
)
{
...
...
@@ -82,9 +86,8 @@ public class SelectorFactory {
}
private
<
G
extends
Gene
<?,
G
>,
C
extends
Comparable
<?
super
C
>>
EliteSelector
<
G
,
C
>
createEliteSelector
(
final
Instance
config
)
{
int
count
=
LanguageHelper
.
lookup
(
config
,
"count"
);
final
Instance
nonEliteSelectorConfig
=
LanguageHelper
.
lookup
(
config
,
"nonEliteSelector"
);
int
count
=
(
int
)(
LanguageHelper
.<
Double
>
lookup
(
config
,
"size-factor"
)
*
sizeOfPopulation
);
final
Instance
nonEliteSelectorConfig
=
LanguageHelper
.
lookup
(
config
,
"non-elite-selector"
);
if
(
nonEliteSelectorConfig
==
null
)
{
return
new
EliteSelector
<>(
count
);
...
...
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