This script is solving set problems by brute-force. See HOWTO.
HOWTO
Use python3.10 or newer. Download it here.
"python.exe" -m pip install SetSolver1
First import the module:
import SetSolver1
Now you can use the method:
SetSolver1.search(const_dict: dict[str, set[frozenset | int | tuple] | MathSet] | ConstDictType,
result: set[frozenset | int | tuple] | MathSet | ResultType,
not_allowed: list[MODE] = None,
identity: RelationMathSet | None = None,
overflow: int = 30,
range_int: int = 20,
do_print: bool = True) -> ResultWay | None
Where const_dict is a dictionary for the predefined constants and result is the wanted solution.
With the method search you can find probably the shortest way to this solution by the predefined constants
and normal set operations. With this method you will get an ResultWay object back.
import SetSolver1
# Here you set your predefined constants.
# Please make sure that you do not assign a variable letter twice.
# Python dictionaries will otherwise only store the last value and overwrite the previous ones.
const_dict = SetSolver1.SimpleMathSetConstDictType(
{
"A": {frozenset({2, frozenset()}), frozenset({5})}, # string "[[2, []],[5]]" is allowed too
"B": {frozenset(), frozenset({3}), frozenset({5})}
}
)
# Here you set your wanted solution.
result = SetSolver1.SimpleMathSetResultType({frozenset(), frozenset({3}), frozenset({5}), frozenset({frozenset()})})
output = SetSolver1.search(const_dict, result)
More examples are here See German examples explanation here with outputs.
Requirements
- python3.10 required
Credits
-
https://stackoverflow.com/a/30676267 / https://stackoverflow.com/a/35781654
-
Append values to set: https://stackoverflow.com/a/3392370
-
fastest way to sort a set: https://stackoverflow.com/a/13605607
Metadata
Release files for SetSolver1 1!2021.12.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| SetSolver1-1!2021.12.2.tar.gz | 23.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| SetSolver1-1!2021.12.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.3 kB
Release files / SetSolver1-1!2021.12.2.tar.gz
| Download URL | SetSolver1-1!2021.12.2.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
727be506bd59d9a4c334119d40162594459c3da7da91960b96adc8857cdc20fb
|
|
BLAKE2b-256 checksum How to use checksums |
93dd2ee0c2b74ae3d042b3a4ca0a8be4c35d54607fac791ad05ff3e97a72e9ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
|
Release files / SetSolver1-1!2021.12.2-py3-none-any.whl
| Download URL | SetSolver1-1!2021.12.2-py3-none-any.whl |
|---|---|
| Size | 25.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f9b0a03b986661c177a8720026b0000155795af1b0b7467e7954f6917f775c45
|
|
BLAKE2b-256 checksum How to use checksums |
de97137191b5969d7ae85a7a9a523ba859f42b9cdacd2b8eb3abaefb21f2f2b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
|