woche12 > master: code py - schemata für walks + genetic

This commit is contained in:
RD 2022-06-21 17:24:30 +02:00
parent aaa0b7a124
commit 3d05f7ae1d
2 changed files with 129 additions and 0 deletions

View File

@ -150,6 +150,51 @@ components:
type: string type: string
default: [] default: []
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Algorithm: Random Walk
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CommandRandomWalk:
description: |-
Instructions for execution of random walks to determine local extrema in a fitness landscape
type: object
required:
- name
- algorithm
- landscape
- optimise
properties:
name:
$ref: '#/components/schemas/EnumAlgorithmNames'
algorithm:
$ref: '#/components/schemas/EnumWalkMode'
landscape:
$ref: '#/components/schemas/DataTypeLandscapeGeometry'
optimise:
$ref: '#/components/schemas/EnumOptimiseMode'
annealing:
type: boolean
default: false
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Algorithm: Genetic Algorithm
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CommandGenetic:
description: |-
Instructions for execution of the Genetic algorithm
type: object
required:
- name
- population
properties:
name:
$ref: '#/components/schemas/EnumAlgorithmNames'
population:
type: array
items:
type: array
items:
type: string
minItems: 2
# maxItems: 2 # FIXME: does not work!
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Algorithm: Euklidean algorithm # Algorithm: Euklidean algorithm
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CommandEuklid: CommandEuklid:
@ -190,6 +235,44 @@ components:
default: 2 default: 2
minimum: 2 minimum: 2
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Data-type Landscape Geometry, Landscape Values
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DataTypeLandscapeGeometry:
description: |-
Structure for the geometry of a fitness landscape
type: object
required:
- neighbourhoods
- values
properties:
neighbourhoods:
$ref: '#/components/schemas/DataTypeLandscapeNeighbourhoods'
values:
$ref: '#/components/schemas/DataTypeLandscapeValues'
DataTypeLandscapeNeighbourhoods:
description: |-
Options for the definition of discrete neighbourhoods of a fitness landscape
type: object
required:
- metric
properties:
radius:
type: number
minimum: 1
default: 1
metric:
$ref: '#/components/schemas/EnumLandscapeMetric'
DataTypeLandscapeValues:
description: |-
A (potentially multi-dimensional) array of values for the fitness landscape.
oneOf:
- type: array
items:
type: number
- type: array
items:
$ref: '#/components/schemas/DataTypeLandscapeValues'
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Enum Algorithm Names # Enum Algorithm Names
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EnumAlgorithmNames: EnumAlgorithmNames:
@ -201,6 +284,8 @@ components:
- TSP - TSP
- HIRSCHBERG - HIRSCHBERG
- RUCKSACK - RUCKSACK
- RANDOM-WALK
- GENETIC
- EUKLID - EUKLID
- POLLARD-RHO - POLLARD-RHO
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -223,3 +308,29 @@ components:
enum: enum:
- GREEDY - GREEDY
- BRANCH-AND-BOUND - BRANCH-AND-BOUND
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Enum Type of walk mode for fitness walk algorithm
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EnumWalkMode:
description: |-
Enumeration of walk mode for fitness walk algorithm
- `ADAPTIVE` - points uniformly randomly chosen from nbhd.
- `GRADIENT` - points uniformly randomly chosen amongst points in nbhd with steepest gradient.
- `METROPOLIS` - points uniformly randomly chosen from nbhd. or by entropy.
type: string
enum:
- ADAPTIVE
- GRADIENT
- METROPOLIS
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Enum for metric for neighbourhoods in fitness landscape
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EnumLandscapeMetric:
description: |-
Enumeration of mode for Rucksack problem
- `MAXIMUM` - `Q` is a neighbour of `P` <==> `max_i d(P_i, Q_i) <= r`
- `MANHATTAN` - `Q` is a neighbour of `P` <==> `sum_i d(P_i, Q_i) <= r`
type: string
enum:
- MAXIMUM
- MANHATTAN

View File

@ -54,6 +54,8 @@ components:
- tarjan - tarjan
- hirschberg - hirschberg
- rucksack - rucksack
- random-walk
- genetic
- euklid - euklid
- pollard-rho - pollard-rho
properties: properties:
@ -129,6 +131,22 @@ components:
items: items:
$ref: '#/components/schemas/EnumRucksackShow' $ref: '#/components/schemas/EnumRucksackShow'
default: [] default: []
random-walk:
type: object
required:
- verbose
properties:
verbose:
type: boolean
default: false
genetic:
type: object
required:
- verbose
properties:
verbose:
type: boolean
default: false
euklid: euklid:
type: object type: object
required: required: