Skip to content

Commit

Permalink
Extend project with the following functions:
Browse files Browse the repository at this point in the history
+ Object-oriented programming
+ new properterty-checks on relations

v2021.12.1
  • Loading branch information
LukasWestholt committed Dec 3, 2021
1 parent 6fa0a14 commit fd4eab7
Show file tree
Hide file tree
Showing 11 changed files with 597 additions and 218 deletions.
1 change: 1 addition & 0 deletions .idea/SetSolver1.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import SetSolver1

Now you can use the method:
```
SetSolver1.search(const_sets: dict[str, set[frozenset | int]], result: set[frozenset | int], not_allowed: list = None) -> list[set] | None
SetSolver1.search(const_sets: dict[str, set[frozenset | int | tuple] | MathSet], result: set[frozenset | int | tuple] | MathSet, not_allowed: list = None, identity: Identity = None) -> list[MathSet] | None
```

Where `const_sets` is a dictionary for the predefined constants and `result` is the wanted solution.
Expand Down Expand Up @@ -64,3 +64,21 @@ See German examples [here](beispiele.md) with outputs.
- https://stackoverflow.com/a/28845328
- https://stackoverflow.com/a/5931299
- https://stackoverflow.com/a/15768778


- https://stackoverflow.com/a/403426
- https://stackoverflow.com/a/11324771
- https://stackoverflow.com/a/30676267 / https://stackoverflow.com/a/35781654
- https://stackoverflow.com/a/25176504
- https://stackoverflow.com/a/61841955
- https://stackoverflow.com/q/17843785
- https://stackoverflow.com/a/33533514
- https://stackoverflow.com/a/4005412
- https://stackoverflow.com/a/4932473
- https://stackoverflow.com/a/2626364
- https://stackoverflow.com/a/18138687
- https://stackoverflow.com/a/27761524
- https://stackoverflow.com/a/3787481
- Enum: https://stackoverflow.com/a/1695250
- Append values to set: https://stackoverflow.com/a/3392370
- fastest way to sort a set: https://stackoverflow.com/a/13605607
19 changes: 19 additions & 0 deletions SetSolver1/MODE.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# tuple of index, used_vars, priority
UNION = 0, (1, 2), 1
COMPLEMENT_X = 1, (1, 2), 1
COMPLEMENT_Y = 2, (2, 1), 1
INTERSECTION = 3, (1, 2), 2
COMPOSITION_X = 4, (1, 2), 3
COMPOSITION_Y = 5, (2, 1), 3
POWER_SET_X = 6, (1,), 4
POWER_SET_Y = 7, (2,), 4
CONVERSE_RELATION_X = 8, (1,), 3
CONVERSE_RELATION_Y = 9, (2,), 3
REFLEXIVE_CLOSURE_X = 10, (1,), 2
REFLEXIVE_CLOSURE_Y = 11, (2,), 2
TRANSITIVE_CLOSURE_X = 12, (1,), 2
TRANSITIVE_CLOSURE_Y = 13, (2,), 2

CHOOSE_BY_INDEX = (UNION, COMPLEMENT_X, COMPLEMENT_Y, INTERSECTION, COMPOSITION_X, COMPOSITION_Y, POWER_SET_X,
POWER_SET_Y, CONVERSE_RELATION_X, CONVERSE_RELATION_Y, REFLEXIVE_CLOSURE_X, REFLEXIVE_CLOSURE_Y,
TRANSITIVE_CLOSURE_X, TRANSITIVE_CLOSURE_Y)
6 changes: 6 additions & 0 deletions SetSolver1/STATUS.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from enum import Enum


class STATUS(Enum):
CONST = 1
NONE = 2
16 changes: 16 additions & 0 deletions SetSolver1/helper/update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from SetSolver1.math_set import TinyMathSet


def to_tiny_math_set(set_of_frozenset_s):
"""
helper method to update to 2021.11.3
:type set_of_frozenset_s: set[frozenset | int | tuple] | frozenset | int | tuple
:rtype: TinyMathSet | int | tuple
"""
if type(set_of_frozenset_s) == frozenset or type(set_of_frozenset_s) == set:
items = list()
for x1 in set_of_frozenset_s:
items.append(to_tiny_math_set(x1))
# print(items)
return TinyMathSet(items)
return set_of_frozenset_s
Loading

0 comments on commit fd4eab7

Please sign in to comment.