From 2cef1292c1138bc11213722545451c1b96727f56 Mon Sep 17 00:00:00 2001
From: "niehues.mark@gmail.com" <niehues.mark@gmail.com>
Date: Wed, 29 Apr 2020 15:12:10 +0200
Subject: [PATCH] brroken wip

---
 evrouting/gasstation/routing.py |  6 ++++--
 evrouting/graph_tools.py        | 17 +++++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/evrouting/gasstation/routing.py b/evrouting/gasstation/routing.py
index 580cb3b..03e87c7 100644
--- a/evrouting/gasstation/routing.py
+++ b/evrouting/gasstation/routing.py
@@ -8,8 +8,8 @@ from evrouting.graph_tools import (
     DISTANCE_KEY,
     consumption,
     distance,
-    charging_cofficient,
 )
+
 from evrouting.graph_tools import sum_weights as fold_path
 
 
@@ -20,7 +20,8 @@ def insert_start_node(s: Node,
                       graph_extended: nx.DiGraph,
                       capacity: SoC,
                       initial_soc: SoC,
-                      c: float = 1.
+                      c: float = 1.,
+                      charging_coefficient=charging_cofficient
                       ) -> nx.DiGraph:
     """Insert s into extended graph an create states and edges as necessary."""
     graph_extended.add_node((s, initial_soc))
@@ -63,6 +64,7 @@ def insert_final_node(t: Node,
                       capacity: SoC,
                       final_soc: SoC,
                       c: float = 1.
+                      charging_cofficient=charging_cofficient
                       ) -> nx.DiGraph:
     """Insert terminal node into extended graph an create states and edges as necessary."""
     graph_extended.add_node((t, final_soc))
diff --git a/evrouting/graph_tools.py b/evrouting/graph_tools.py
index 0add35f..b724014 100644
--- a/evrouting/graph_tools.py
+++ b/evrouting/graph_tools.py
@@ -69,3 +69,20 @@ def consumption_function_distance_factory(consumption: float) -> ConsumptionFunc
             return G[u][v][CONSUMPTION_KEY]
 
     return c
+
+
+class AccessFunctions:
+    def __init__(self,
+                 distance=distance,
+                 consumption=consumption,
+                 charging_coefficient=charging_cofficient
+                 ):
+        self.distance = distance
+        self.consumption = consumption
+        self.charging_coefficient = charging_coefficient
+
+    def path_distance(self, G, path):
+        sum_weights(G, path, weight=DISTANCE_KEY)
+
+    def path_consumption(self, G, path):
+        sum_weights(G, path, weight=CONSUMPTION_KEY)
-- 
GitLab