pykp.knapsack.Knapsack.
from_file#
- classmethod Knapsack.from_file(path: str)#
Initialise a knapsack instance from a JSON file.
- Parameters:
- pathstr
The file path to the JSON file containing the knapsack instance specification.
- Returns:
- Knapsack
A new instance of the Knapsack class initialised from the JSON file.
Examples
>>> knapsack = Knapsack.from_file("input.json")