master > master: code py - verbesserte Darstellung + »korrekte« Behandlung von Reihenfolgen
- im Kurs wird die Permutation nur für Greedy-Berechnungen angewandt - die Reihenfolge der Items in der Hauptberechnung bei B&B bleibt wie bei Angaben
This commit is contained in:
@@ -24,10 +24,10 @@ __all__ = [
|
||||
|
||||
@dataclass
|
||||
class SolutionRaw():
|
||||
vector: Union[List[int], List[float]] = field();
|
||||
vector: List[float] = field();
|
||||
items: List[str] = field();
|
||||
values: List[float] = field(repr=False);
|
||||
weights: List[float] = field(repr=False);
|
||||
costs: List[float] = field(repr=False);
|
||||
|
||||
class Solution(SolutionRaw):
|
||||
@property
|
||||
@@ -40,7 +40,7 @@ class Solution(SolutionRaw):
|
||||
|
||||
@property
|
||||
def total_weight(self) -> float:
|
||||
return sum([ self.vector[i]*x for (i, x) in zip(self.support, self.weights) ]);
|
||||
return sum([ self.vector[i]*x for (i, x) in zip(self.support, self.costs) ]);
|
||||
|
||||
@property
|
||||
def total_value(self) -> float:
|
||||
|
||||
Reference in New Issue
Block a user