graph: Adjust calculation to match exercise

This commit is contained in:
Marco Thomas
2022-07-27 14:32:37 +02:00
parent 0b29bdab3d
commit d6a8689175
6 changed files with 183 additions and 90 deletions

View File

@@ -15,22 +15,33 @@ class LocationType(Enum):
class TransportData():
def __init__(self, co2: float, speed: float, distance_penalty: float):
def __init__(self, co2: float, speed: float):
self.co2 = co2
self.speed = speed
self.distance_penalty = distance_penalty
def __str__(self):
return f"{{co2: {self.co2}, speed: {self.speed}}}"
def __repr__(self):
return self.__str__()
class TransportMethod(Enum):
WALK = TransportData(0, 4)
CITY = TransportData(0.189, 30)
AUTOBAHN = TransportData(0.189, 100)
OEPNV = TransportData(0.055, 30)
ICE = TransportData(0.055, 100)
AIRPLANE = TransportData(0.2113, 900)
class TransportKind(Enum):
"""
(co2 emission, speed, distance_penalty)
distance_penalty
"""
WALK = TransportData(0, 4, 0.2)
CITY = TransportData(0.189, 30, 0.2)
AUTOBAHN = TransportData(0.189, 100, 0.2)
OEPNV = TransportData(0.055, 30, 0.1)
ICE = TransportData(0.055, 100, 0.1)
AIRPLANE = TransportData(0.2113, 900, 0.02)
INDIVIDUAL = 0.2
TRAIN = 0.1
FLYING = 0.02
class Coordinate: