- Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathBranchAndBoundNode.cs
29 lines (22 loc) · 1 KB
/
BranchAndBoundNode.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
namespaceAlgorithms.Knapsack;
publicclassBranchAndBoundNode
{
// isTaken --> true = the item where index = level is taken, vice versa
publicboolIsTaken{get;}
// cumulativeWeight --> um of weight of item associated in each nodes starting from root to this node (only item that is taken)
publicintCumulativeWeight{get;set;}
// cumulativeValue --> sum of value of item associated in each nodes starting from root to this node (only item that is taken)
publicdoubleCumulativeValue{get;set;}
// upperBound --> largest possible value after taking/not taking the item associated to this node (fractional)
publicdoubleUpperBound{get;set;}
// level --> level of the node in the tree structure
publicintLevel{get;}
// parent node
publicBranchAndBoundNode?Parent{get;}
publicBranchAndBoundNode(intlevel,booltaken,BranchAndBoundNode?parent=null)
{
Level=level;
IsTaken=taken;
Parent=parent;
}
}