{"library":"prtpy","title":"prtpy - Number Partitioning","description":"prtpy is a Python library for number partitioning. It provides various algorithms to divide a list of numbers into a specified number of subsets, typically aiming to minimize the largest sum of a subset. It is actively maintained, with the current version being 0.8.3, and releases occur as new algorithms, improvements, or bug fixes are introduced.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install prtpy"],"cli":null},"imports":["from prtpy import partition","from prtpy.partition import greedy","from prtpy.partition import ilp"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from prtpy import partition\nfrom prtpy.partition import greedy\n\nnumbers = [3, 4, 5, 6, 7, 8, 9, 10]\nnum_bins = 3\n\n# Partition the numbers into 3 bins using the greedy algorithm\nresult = partition(algorithm=greedy, num_bins=num_bins, items=numbers)\n\nprint(f\"Original numbers: {numbers}\")\nprint(f\"Number of bins: {num_bins}\")\nprint(f\"Partition result (greedy): {result}\")\n# Expected output for the given input might be similar to: [[10, 8, 3], [9, 7, 4], [6, 5]]","lang":"python","description":"This quickstart demonstrates how to use `prtpy` to partition a list of numbers into a specified number of bins using the greedy algorithm. The `partition` function acts as a general interface, accepting the algorithm as a parameter.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}