Gitlab Community Edition Instance
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Pygma
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
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
Winfried Gero Oed
Pygma
Commits
b60a9daa
Commit
b60a9daa
authored
1 year ago
by
Winfried Gero Oed
Browse files
Options
Downloads
Patches
Plain Diff
Delete config-Copy1.py
parent
31ee6309
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/config-Copy1.py
+0
-133
0 additions, 133 deletions
src/config-Copy1.py
with
0 additions
and
133 deletions
src/config-Copy1.py
deleted
100755 → 0
+
0
−
133
View file @
31ee6309
from
components.genetic_operators
import
Mutation_operator
,
Single_point_crossover_operator
,
Removal_operator
from
components.evolutionary_phase
import
Simple_evolutionary_phase
from
components.experiment
import
Function_optimisation_experiment
# -----------------------------
# Genetic operator definition
# -----------------------------
# Genetic operators can be used for:
# Populations
# Genetic Phases
OP_MUTATION
=
Mutation_operator
(
0.06
)
OP_REMOVAL
=
Removal_operator
(
6
)
OP_CROSSOVER
=
Single_point_crossover_operator
(
6
)
# -----------------------------
# Phase definition
# -----------------------------
# Genetic phases allowing for evolution of individuals in
# changing environments or conditions.
# phase 0
# phase starting operators (applied at phase start)
PHASE0_SOP
=
[
OP_MUTATION
,
OP_MUTATION
]
# phase Experiment (conducted on individuals)
PHASE0_EXPERIMENT
=
Function_optimisation_experiment
()
# phase definition
PHASE0
=
Simple_evolutionary_phase
(
'
Phase_0
'
,
PHASE0_SOP
,
PHASE0_EXPERIMENT
)
# phase 1
# -----------------------------
# GA Configuration parameters
# -----------------------------
# These are all general parameters for the Algorithm
# in form of a dictionary
CONFIG
=
{
# -------------
# Processes
# --------------
# use mpi parallelization
# If use_mpi4py_futures=False start with:
# mpiexec -n 3 python PyGMA.py
# or use threads if not specified via slurm
# mpiexec -n 3 --use-hwthread-cpus python PyGMA.py
'
use_mpi
'
:
False
,
# use mpi4py.futures
# this will dynamically spawn workers.
# NOTE: you have to execute the programm in this manner:
# mpiexec -n 3 python -m mpi4py.futures PyGMA.py
'
use_mpi4py_futures
'
:
False
,
# if mpi=False, how many local processes to use
# Note if > 1 it will spawn additonal processes that independently
# solves the experiment. Spawning takes time (memcopys etc)
# if the experiment is very simple having only one process
# handling everyting might be faster.
# start programm with:
# python PyGMA.py
'
num_local_processes
'
:
1
,
# -------------
# Populations
# --------------
# how many island populations to use
# is defined by the genetic operators stack lenght
# used to recombine/produce, mutate, extend...
'
genetic_operator_stack
'
:
[
# pop 0
[
OP_REMOVAL
,
OP_CROSSOVER
],
# pop 1
[
OP_REMOVAL
,
OP_CROSSOVER
,
OP_MUTATION
],
# pop 2
[
OP_REMOVAL
,
OP_REMOVAL
,
OP_REMOVAL
,
OP_MUTATION
,
OP_CROSSOVER
,
OP_CROSSOVER
,
OP_CROSSOVER
]
],
# how many island populations to use
# 'num_populations': 3,
# how many individuals per population
'
num_individuals
'
:
30
,
# genome lenght for each individual
'
genome_length
'
:
60
,
# init populations from defined gene strings
# this will ovveride:
# num_populations, num_individuals, genome_length
'
use_predefined_defined_genes
'
:
False
,
'
predefined_genes
'
:
[
# pop 0
[[
0
,
0
,
1
],
[
0
,
1
,
1
]],
# pop 1
[[
0
,
1
,
1
],
[
1
,
1
,
1
]]
],
# -------------
# Evolutinary Phases
# --------------
# defining the phases that will be sequantially evolved
'
evolutionary_phases
'
:
[
PHASE0
,
PHASE0
]
}
# -----------------------------
# check configured parameters
# -----------------------------
def
check_config
():
# IMP
# will check if all parameters are available and within
# reasonable range
# really do this?
# only for most critical parts that have to fit.
# check if genetic operators are enough in every phase
if
CONFIG
[
'
use_predefined_defined_genes
'
]
and
len
(
CONFIG
[
'
genetic_operator_stack
'
])
!=
len
(
CONFIG
[
'
predefined_genes
'
]):
print
(
f
"
Warning: having an genetic operator stack for only
{
len
(
CONFIG
[
'
genetic_operator_stack
'
])
}
but there are genes defined for
{
len
(
CONFIG
[
'
predefined_genes
'
])
}
. Will not use all genes, only those having an operator stack.
"
)
return
return
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