master > master: code py - refactoring
This commit is contained in:
parent
0116e2fbfb
commit
b4a5ee213c
@ -7,11 +7,11 @@
|
||||
[2, 7, 4, 0],
|
||||
]
|
||||
optimise: MIN
|
||||
# Beispiele für Seminarwoche 10 (Blatt 9)
|
||||
## Beispiele für Seminarwoche 10 (Blatt 9)
|
||||
- name: HIRSCHBERG
|
||||
word1: 'happily ever after'
|
||||
word2: 'apples'
|
||||
once: false
|
||||
once: true
|
||||
- name: HIRSCHBERG
|
||||
word1: 'happily'
|
||||
word2: 'applses'
|
||||
|
@ -14,6 +14,6 @@ options:
|
||||
verbose:
|
||||
- COSTS
|
||||
- MOVES
|
||||
# show:
|
||||
# # - ATOMS
|
||||
# - TREE
|
||||
show:
|
||||
# - ATOMS
|
||||
- TREE
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
import os;
|
||||
import sys
|
||||
from token import MINUS;
|
||||
|
||||
os.chdir(os.path.join(os.path.dirname(__file__)));
|
||||
sys.path.insert(0, os.getcwd());
|
||||
@ -17,10 +16,10 @@ from src.thirdparty.maths import *;
|
||||
from models.generated.commands import *;
|
||||
from src.core.log import *;
|
||||
from src.setup.config import *;
|
||||
from src.graphs.graph import *;
|
||||
from src.graphs.tarjan import *;
|
||||
from src.tsp import *;
|
||||
from src.hirschberg import *;
|
||||
from src.models.graphs.graph import *;
|
||||
from src.algorithms.tarjan.algorithms import *;
|
||||
from src.algorithms.tsp import *;
|
||||
from src.algorithms.hirschberg import *;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# GLOBAL CONSTANTS/VARIABLES
|
||||
|
@ -5,9 +5,9 @@
|
||||
# IMPORTS
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
from src.hirschberg.algorithms import *;
|
||||
from src.hirschberg.constants import *;
|
||||
from src.hirschberg.display import *;
|
||||
from src.algorithms.hirschberg.algorithms import *;
|
||||
from src.models.hirschberg.penalties import *;
|
||||
from src.algorithms.hirschberg.display import *;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# EXPORTS
|
@ -9,11 +9,11 @@ from src.thirdparty.types import *;
|
||||
from src.thirdparty.maths import *;
|
||||
|
||||
from models.generated.config import *;
|
||||
from src.hirschberg.constants import *;
|
||||
from src.hirschberg.display import *;
|
||||
from src.hirschberg.matrix import *;
|
||||
from src.hirschberg.paths import *;
|
||||
from src.hirschberg.types import *;
|
||||
from src.models.hirschberg.penalties import *;
|
||||
from src.algorithms.hirschberg.display import *;
|
||||
from src.algorithms.hirschberg.matrix import *;
|
||||
from src.algorithms.hirschberg.paths import *;
|
||||
from src.models.hirschberg.alignment import *;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# EXPORTS
|
@ -9,7 +9,7 @@ from src.thirdparty.types import *;
|
||||
from src.thirdparty.maths import *;
|
||||
|
||||
from models.generated.config import *;
|
||||
from src.hirschberg.constants import *;
|
||||
from src.models.hirschberg.penalties import *;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# EXPORTS
|
@ -8,7 +8,7 @@
|
||||
from src.thirdparty.types import *;
|
||||
from src.thirdparty.maths import *;
|
||||
|
||||
from src.hirschberg.constants import *;
|
||||
from src.models.hirschberg import *;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# EXPORTS
|
@ -8,7 +8,7 @@
|
||||
from src.thirdparty.types import *;
|
||||
from src.thirdparty.maths import *;
|
||||
|
||||
from src.hirschberg.constants import *;
|
||||
from src.models.hirschberg import *;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# EXPORTS
|
16
code/python/src/algorithms/tarjan/__init__.py
Normal file
16
code/python/src/algorithms/tarjan/__init__.py
Normal file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# IMPORTS
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
from src.algorithms.tarjan.algorithms import *;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# EXPORTS
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
__all__ = [
|
||||
'tarjan_algorithm',
|
||||
];
|
@ -10,8 +10,8 @@ from __future__ import annotations;
|
||||
from src.thirdparty.types import *;
|
||||
|
||||
from src.core.log import *;
|
||||
from src.stacks.stack import *;
|
||||
from src.graphs.graph import *;
|
||||
from src.models.stacks import *;
|
||||
from src.models.graphs import *;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# EXPORTS
|
@ -5,7 +5,7 @@
|
||||
# IMPORTS
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
from src.tsp.algorithms import *;
|
||||
from src.algorithms.tsp.algorithms import *;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# EXPORTS
|
16
code/python/src/models/graphs/__init__.py
Normal file
16
code/python/src/models/graphs/__init__.py
Normal file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# IMPORTS
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
from src.models.graphs.graph import *;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# EXPORTS
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
__all__ = [
|
||||
'Graph',
|
||||
];
|
23
code/python/src/models/hirschberg/__init__.py
Normal file
23
code/python/src/models/hirschberg/__init__.py
Normal file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# IMPORTS
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
from src.models.hirschberg.alignment import *;
|
||||
from src.models.hirschberg.paths import *;
|
||||
from src.models.hirschberg.penalties import *;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# EXPORTS
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
__all__ = [
|
||||
'Alignment',
|
||||
'AlignmentBasic',
|
||||
'AlignmentPair',
|
||||
'Directions',
|
||||
'gap_penalty',
|
||||
'missmatch_penalty',
|
||||
];
|
28
code/python/src/models/hirschberg/paths.py
Normal file
28
code/python/src/models/hirschberg/paths.py
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# IMPORTS
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
from src.thirdparty.types import *;
|
||||
from src.setup.config import *;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# EXPORTS
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
__all__ = [
|
||||
'Directions',
|
||||
];
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# ENUMS
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
class Directions(Enum):
|
||||
UNSET = -1;
|
||||
# Prioritäten hier setzen
|
||||
DIAGONAL = 0;
|
||||
HORIZONTAL = 1;
|
||||
VERTICAL = 2;
|
@ -13,22 +13,10 @@ from src.setup.config import *;
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
__all__ = [
|
||||
'Directions',
|
||||
'gap_penalty',
|
||||
'missmatch_penalty',
|
||||
];
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# ENUMS
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
class Directions(Enum):
|
||||
UNSET = -1;
|
||||
# Prioritäten hier setzen
|
||||
DIAGONAL = 0;
|
||||
HORIZONTAL = 1;
|
||||
VERTICAL = 2;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# PENALTIES
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
16
code/python/src/models/stacks/__init__.py
Normal file
16
code/python/src/models/stacks/__init__.py
Normal file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# IMPORTS
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
from src.models.stacks.stack import *;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# EXPORTS
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
__all__ = [
|
||||
'Stack',
|
||||
];
|
@ -11,7 +11,7 @@ from pytest import mark;
|
||||
from pytest import fixture;
|
||||
from unittest import TestCase;
|
||||
|
||||
from src.graphs.graph import *;
|
||||
from src.models.graphs import *;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# FIXTURES
|
||||
|
@ -13,8 +13,8 @@ from unittest import TestCase;
|
||||
from unittest.mock import patch;
|
||||
|
||||
from src.thirdparty.types import *;
|
||||
from src.graphs.graph import *;
|
||||
from src.graphs.tarjan import *;
|
||||
from src.models.graphs import *;
|
||||
from src.algorithms.tarjan import *;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# FIXTURES
|
||||
|
@ -10,7 +10,7 @@ import pytest;
|
||||
from pytest import mark;
|
||||
from unittest import TestCase;
|
||||
|
||||
from src.stacks.stack import Stack;
|
||||
from src.models.stacks import Stack;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# Fixtures
|
||||
|
Loading…
x
Reference in New Issue
Block a user