You can read about the method in the next article:
- Python 3.6 or higher.
- Installed setuptools.
- Installed wheel.
Run pip install .
.
Run command:
python -m unittest discover -v ./tests
The example:
import random
# Package must be installed.
from nds import ndomsort
seq = [random.sample(range(-10, 11), 5) for i in range(30)]
# It is dictionary.
fronts = ndomsort.non_domin_sort(seq)
# Or we can get values of objectives.
# fronts = ndomsort.non_domin_sort(seq, lambda x: x[:4])
# 'fronts' is a tuple of front's indices, not a dictionary.
# fronts = ndomsort.non_domin_sort(seq, only_front_indices=True)
for front in fronts:
print("\nFront index is {}".format(front))
for seq in fronts[front]:
print("\t{}".format(seq))