pykp.arrangement.Arrangement#

class pykp.arrangement.Arrangement(items: <MagicMock name='mock.ndarray.__getitem__()' id='139960639692080'>, state: <MagicMock name='mock.ndarray.__getitem__()' id='139960639692080'>)#

Bases: object

Represents an arrangement of items for the knapsack problem.

items#

An array of items for the knapsack problem.

Type:

np.ndarray[Item]

state#

Binary array indicating the inclusion or exclusion of items in the arrangement.

Type:

np.ndarray[int]

value#

The total value of items in the arrangement.

Type:

int

weight#

The total weight of items in the arrangement.

Type:

int

__init__(items: <MagicMock name='mock.ndarray.__getitem__()' id='139960639692080'>, state: <MagicMock name='mock.ndarray.__getitem__()' id='139960639692080'>)#

Initialises an Arrangement instance.

Args: items (np.ndarray[Item]): An array of items for the knapsack problem. state (np.ndarray[int]): Binary array indicating the inclusion or

exclusion of items in the arrangement.

capacity (int): The maximum weight capacity constraint for the

arrangement.

Methods

__init__(items, state)

Initialises an Arrangement instance.