Skip to content

Commit

Permalink
Temporary version, for testing with Auke.
Browse files Browse the repository at this point in the history
  • Loading branch information
djgroen committed Oct 31, 2024
1 parent 50891de commit d916ef6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions flee/SimulationSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ def ReadFromYML(ymlfile: str):

# Flee 3+ Fixed Location Routes
SimulationSettings.move_rules["FixedRoutes"] = bool(fetchss(dpr,"fixed_routes",False))
print(f"INFO: Fixed Route Generation for Locations: {SimulationSettings.move_rules["FixedRoutes"]}", file=sys.stderr)

# DFlee Flood Location Move rules
dpf = fetchss(dpr, "flood_rules", None)
Expand Down
5 changes: 3 additions & 2 deletions flee/crawling.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def calculateLocCrawlLinkWeight(

weights = [weight]
routes = [origin_names + [link.endpoint.name]]
else:
step -= 1
#else:
# step -= 1


#print("Endpoint:", link.endpoint.name, weights, routes, origin_names, step)
Expand Down Expand Up @@ -170,5 +170,6 @@ def generateLocationRoutes(l, time: int, debug: bool = False):
time=time,
)

print(f"Generated {len(l.routes)} routes for {l.name} at time {time}.", file=sys.stderr)
return l.routes

2 changes: 1 addition & 1 deletion flee/moving.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ def selectRoute(a, time: int, debug: bool = False, return_all_routes: bool = Fal
for l in a.location.routes.keys():
weights = weights + [a.location.routes[l][0] * getEndPointScore(a, a.location.routes[l][2], time)]
routes = routes + [a.location.routes[l][1]]
#print("FixedRoute Weights", weights, routes, file=sys.stderr)
else:
for k, e in enumerate(a.location.links):
wgt, rts = calculateLinkWeight(
Expand All @@ -517,7 +518,6 @@ def selectRoute(a, time: int, debug: bool = False, return_all_routes: bool = Fal

weights, routes = pruneRoutes(weights, routes)

#print(weights, routes)
route = chooseFromWeights(weights=weights, routes=routes)
#print("route chosen:", route)

Expand Down
1 change: 1 addition & 0 deletions flee/scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,6 @@ def updateLocationScore(time: int, loc) -> None:
# print(time, loc.name,loc.camp,loc.foreign,loc.scores)

if SimulationSettings.move_rules["FixedRoutes"] is True:
#print("INFO: Generating location routes.", file=sys.stderr)
crawling.generateLocationRoutes(loc, time)

0 comments on commit d916ef6

Please sign in to comment.