master > master: code py - config optionen für richtungsprios

This commit is contained in:
RD 2022-06-10 12:40:55 +02:00
parent b4a5ee213c
commit 0145f1f873
5 changed files with 28 additions and 7 deletions

View File

@ -7,7 +7,7 @@
[2, 7, 4, 0], [2, 7, 4, 0],
] ]
optimise: MIN optimise: MIN
## Beispiele für Seminarwoche 10 (Blatt 9) # Beispiele für Seminarwoche 10 (Blatt 9)
- name: HIRSCHBERG - name: HIRSCHBERG
word1: 'happily ever after' word1: 'happily ever after'
word2: 'apples' word2: 'apples'

View File

@ -9,8 +9,14 @@ options:
tsp: tsp:
verbose: true verbose: true
hirschberg: hirschberg:
penality-missmatch: 1 # standardwerte sind (1, 1) und (2, 1):
penality-gap: 1 penality-gap: 1
penality-mismatch: 1
# niedrigerer Wert ==> höhere Priorität:
move-priorities:
diagonal: 0
horizontal: 1
vertical: 2
verbose: verbose:
- COSTS - COSTS
- MOVES - MOVES

View File

@ -57,12 +57,27 @@ components:
hirschberg: hirschberg:
type: object type: object
properties: properties:
penality-missmatch: penality-mismatch:
type: number type: number
default: 1 default: 1
penality-gap: penality-gap:
type: number type: number
default: 1 default: 1
move-priorities:
type: object
properties:
diagonal:
type: integer
minimum: 0
default: 0
horizontal:
type: integer
minimum: 0
default: 1
vertical:
type: integer
minimum: 0
default: 2
verbose: verbose:
type: array type: array
items: items:

View File

@ -23,6 +23,6 @@ __all__ = [
class Directions(Enum): class Directions(Enum):
UNSET = -1; UNSET = -1;
# Prioritäten hier setzen # Prioritäten hier setzen
DIAGONAL = 0; DIAGONAL = OPTIONS.hirschberg.move_priorities.diagonal;
HORIZONTAL = 1; HORIZONTAL = OPTIONS.hirschberg.move_priorities.horizontal;
VERTICAL = 2; VERTICAL = OPTIONS.hirschberg.move_priorities.vertical;

View File

@ -25,4 +25,4 @@ def gap_penalty(x: str):
return OPTIONS.hirschberg.penality_gap; return OPTIONS.hirschberg.penality_gap;
def missmatch_penalty(x: str, y: str): def missmatch_penalty(x: str, y: str):
return 0 if x == y else OPTIONS.hirschberg.penality_missmatch; return 0 if x == y else OPTIONS.hirschberg.penality_mismatch;