public Network: map EdgeId to Edge ==> Network
Network(conn) ==
connections := conn;
public MakeOffer: EdgeId * real ==> ()
MakeOffer (eid, cost) ==
( let reqs = {mu(r,accepted |-> false, cost |-> cost) | r inset requests(eid)} in
offers(eid) := (if eid insetdom offers then offers(eid) else {}) union reqs;
IO`printf("The following offers are made: %s", [offers(eid)])
) pre eid insetdom requests;
public AddRequests: map EdgeId tosetof Request ==> ()
AddRequests(req_m) ==
requests := requests ++ {id |-> req_m(id) union if id insetdom requests then requests(id) else {}
| id insetdom req_m};
pure public GetNotProblematic: () ==> setof EdgeId
GetNotProblematic() == returndunionrng notproblematic;
pure public GetRequests: EdgeId ==> setof Request
GetRequests(eid) == returnif eid insetdom requests then requests(eid) else {};
public ResetNotproblematic: World`TMSId ==> ()
ResetNotproblematic(tmsid) ==
notproblematic(tmsid) := {};
pure public OfInterestTo: EdgeId ==> setof EdgeId
OfInterestTo(edgeid) == let s = connections(edgeid).GetStartNode(),
e = connections(edgeid).GetEndNode() in return {eid | eid insetdom connections
& connections(eid).GetEndNode() = s or connections(eid).GetStartNode() = e} pre edgeid insetdom connections;
public LeadsToInNSteps: EdgeId * nat1 ==> setof EdgeId
LeadsToInNSteps(edgeid,n) == let s = connections(edgeid).GetStartNode(),
leadsto = {eid | eid insetdom connections
& connections(eid).GetEndNode() = s} in if n = 1 thenreturn leadsto elselet starts = {connections(eid).GetEndNode()
| eid inset leadsto},
rest = dunion {LeadsToInNSteps(eid,n-1)
| eid inset leadsto
& connections(eid).GetEndNode() inset starts} in return leadsto union rest pre edgeid insetdom connections;
pure public GetMaxSpeed: EdgeId ==> nat
GetMaxSpeed(edgeid) == return connections(edgeid).maxSpeed pre edgeid insetdom connections;
pure public GetOpenLanes: EdgeId ==> nat
GetOpenLanes(edgeid) == return connections(edgeid).laneCount pre edgeid insetdom connections;
public GetEdgeIds: () ==> setof EdgeId
GetEdgeIds() == returndom connections;
pure public IsInputEdge: EdgeId * EdgeId ==> bool
IsInputEdge (eid1, eid2) == return connections(eid1).GetEndNode() = connections(eid2).GetStartNode() pre {eid1,eid2} subsetdom connections; -- Test if eid1 is an input edge to eid2
pure public IsOutputEdge: EdgeId * EdgeId ==> bool
IsOutputEdge (eid1, eid2) == return connections(eid1).GetStartNode() = connections(eid2).GetEndNode() pre {eid1,eid2} subsetdom connections; -- Test if eid1 is an output edge of eid2
--public AddDiversionRoutes: EdgeId * set of seq of EdgeId ==> () --AddDiversionRoutes(eid,routes) == -- div_routes(eid) := routes;
pure public GetConnections: () ==> map EdgeId to Edge
GetConnections() == return connections;
end Network
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.