My Project
|
Public Member Functions | |
def | __init__ (self, weights, total, profit) |
Constructor used to initialize variables used everywhere in the function. More... | |
def | getItemsUsed (self) |
Once the table of the Knapsack Algorithm is constructed, this function can be used to determine which actors were used to get this table. More... | |
def | algorithm (self) |
This function is used to compute the table in the Knapsack Algorithm. More... | |
Public Attributes | |
weights | |
Contains cost of picking each element. More... | |
total | |
Contains total weight of bag allowed. More... | |
profit | |
Profit associated with picking an element. | |
n | |
Number of elements to be picked from. | |
selected | |
A matrix of size N X (W + 1) | |
marked | |
Boolean List which will indicate which actor is selected after doing 0/1 knapsack. More... | |
Class used for Knapsack implementation. \ Consists of two functions used for computing table, and one for evaluating which actors were chosen to create the table.
def StarCastRecommend.Knap.__init__ | ( | self, | |
weights, | |||
total, | |||
profit | |||
) |
Constructor used to initialize variables used everywhere in the function.
weights | Cost of each actor is stored in this list. |
total | This variable is used to denote the total budget. |
profit | This list indicates the profit of choosing an actor. |
def StarCastRecommend.Knap.algorithm | ( | self | ) |
This function is used to compute the table in the Knapsack Algorithm.
This table self.selected
indicates the best profit for a set of actors.
def StarCastRecommend.Knap.getItemsUsed | ( | self | ) |
Once the table of the Knapsack Algorithm is constructed, this function can be used to determine which actors were used to get this table.
StarCastRecommend.Knap.marked |
Boolean List which will indicate which actor is selected after doing 0/1 knapsack.
StarCastRecommend.Knap.total |
Contains total weight of bag allowed.
StarCastRecommend.Knap.weights |
Contains cost of picking each element.