27 #ifndef __DYNG_NET_HXX__ 28 #define __DYNG_NET_HXX__ 76 DyngError(
const std::string& msg) : std::logic_error(msg) {}
79 DyngError(
const char* msg) : std::logic_error(msg) {}
483 static const Node nonode = -1;
485 static const Arc noarc = -2;
504 template <
typename It,
typename Node,
typename Arc,
505 Arc (
Net::*First) (Node)
const,
506 Arc (
Net::*Next) (Arc)
const>
508 public std::iterator<std::forward_iterator_tag, const Arc>
511 typedef Node node_type;
512 typedef Arc arc_type;
515 ArcIterator(
const Net* net) :
519 ArcIterator(
const Net* net, Node node) :
520 _net(net), _arc((net->*First)(node))
523 Arc operator*()
const {
return _arc; }
525 bool operator==(
const It& it)
const {
526 return _arc == it._arc;
529 bool operator!=(
const It& it)
const {
530 return _arc != it._arc;
534 _arc = (_net->*Next)(_arc);
535 return static_cast<It&
>(*this);
543 template <
typename It>
547 ArcList(
const Net* net,
typename It::node_type node):
548 _net(net), _node(node)
552 return It(_net, _node);
561 typename It::node_type _node;
576 Net(
const Net& net) =
delete;
579 Net& operator=(
const Net& net) =
delete;
585 Net& operator=(
Net&& net);
594 index_type n_groups()
const;
616 Group add_groups(index_type ngroups);
622 index_type n_basenodes()
const;
632 BaseNode add_basenode(Group group);
641 Group base_group(BaseNode bnode)
const;
655 index_type base_groupidx(BaseNode bnode)
const;
664 bool base_waitnode(BaseNode bnode)
const;
673 BaseArc base_firstout(BaseNode bnode)
const;
682 BaseArc base_firstin(BaseNode bnode)
const;
688 index_type n_basearcs()
const;
699 BaseArc add_basearc(BaseNode bsrc, BaseNode bsnk);
715 BaseArc base_arc(BaseNode bsrc, BaseNode bsnk)
const;
727 void add_runningtime(BaseArc arc, RunTime running_time);
743 void add_runningtimes(BaseArc arc,
745 const RunTime running_times[]);
749 const std::vector<RunTime>& running_times)
751 add_runningtimes(arc, running_times.size(), &(running_times[0]));
765 BaseArc base_nextout(BaseArc arc)
const;
778 BaseArc base_nextin(BaseArc arc)
const;
788 BaseNode base_src(BaseArc arc)
const;
798 BaseNode base_snk(BaseArc arc)
const;
808 using ArcIterator::ArcIterator;
815 using ArcList::ArcList;
827 public Net::ArcIterator<BaseInIterator,
829 &Net::base_firstin, &Net::base_nextin>
831 using ArcIterator::ArcIterator;
838 using ArcList::ArcList;
877 Time group_mintime(Group group)
const;
889 Time basenode_mintime(BaseNode bnode)
const;
898 index_type n_nodes()
const;
915 Node node(BaseNode bnode, Time time)
const;
929 BaseNode basenode(Node node)
const;
944 Time time(Node node)
const;
959 Arc firstout(Node node)
const;
974 Arc firstin(Node node)
const;
983 index_type n_arcs()
const;
1001 Arc arc(Node src, Node snk)
const;
1025 Arc find_arc(BaseNode bsrc, Time srctime, BaseNode bsnk, Time snktime)
const;
1035 bool isactive(Arc arc)
const;
1047 Node src(Arc arc)
const;
1060 Node snk(Arc arc)
const;
1077 Arc nextout(Arc arc)
const;
1094 Arc nextin(Arc arc)
const;
1100 public Net::ArcIterator<BaseOutIterator,
1102 &Net::firstout, &Net::base_nextout>
1104 using ArcIterator::ArcIterator;
1111 using ArcList::ArcList;
1123 public Net::ArcIterator<BaseInIterator,
1125 &Net::firstin, &Net::base_nextin>
1127 using ArcIterator::ArcIterator;
1133 class InList:
public ArcList<BaseInIterator> {
1134 using ArcList::ArcList;
1139 return InList(
this, bnode);
1161 void force_active(Group grp, Time time_active);
1166 Time active_time(Group grp)
const;
1196 Result shortest_path(
const double basecosts[],
1197 const double augcosts[],
1202 Result shortest_path(
const std::vector<double>& basecosts,
1203 const std::vector<double>& augcosts,
1208 Result shortest_path(
const double basecosts[],
const double augcosts[]);
1211 Result shortest_path(
const std::vector<double>& basecosts,
1212 const std::vector<double>& augcosts);
1215 index_type get_n_newnodes()
const;
1218 index_type get_n_newarcs()
const;
1227 index_type get_pathlen()
const;
1240 double get_path(Arc path[])
const;
1246 double get_path(std::vector<Arc>& path)
const;
1253 index_type get_num_new_active()
const;
1262 void get_new_active(Arc active[])
const;
1269 void get_new_active(std::vector<Arc>& active)
const;
1274 std::unique_ptr<Data> data;
Iterator over the incoming arcs of a base node.
Definition: Net.hxx:826
OutList outarcs(BaseNode bnode) const
Return a list of outgoing arcs of a node.
Definition: Net.hxx:1115
static const Arc noarc
ID of a non-existing arc.
Definition: Net.hxx:485
A logical error in the use of the dynamic network occurred.
Definition: Net.hxx:68
Iterator over the outgoing arcs of a node.
Definition: Net.hxx:1099
Wrapper to provide an iterator over the outgoing arcs of a node.
Definition: Net.hxx:1110
BaseOutList base_outarcs(BaseNode bnode) const
Return a list of outgoing arcs of a base node.
Definition: Net.hxx:819
Wrapper to provide an iterator over the outgoing arcs of a base node.
Definition: Net.hxx:814
index_type BaseNode
Type of base nodes.
Definition: Net.hxx:465
index_type Node
Type of nodes.
Definition: Net.hxx:471
Wrapper to provide an iterator over the incoming arcs of a node.
Definition: Net.hxx:1133
index_type BaseArc
Type of base arcs.
Definition: Net.hxx:468
index_type RunTime
Type of running times.
Definition: Net.hxx:480
BaseInList base_inarcs(BaseNode bnode) const
Return a list of incoming arcs of a base node.
Definition: Net.hxx:842
BaseArc base_nextout(BaseArc arc) const
Return the next outgoing base arc.
BaseArc base_firstout(BaseNode bnode) const
Return first outgoing arc of a node in the base graph.
DyngError(const char *msg)
Definition: Net.hxx:79
void add_runningtimes(BaseArc arc, const std::vector< RunTime > &running_times)
Definition: Net.hxx:748
Wrapper to provide an iterator over the incoming arcs of a base node.
Definition: Net.hxx:837
index_type Time
Type of time indices.
Definition: Net.hxx:477
index_type Group
Type of groups.
Definition: Net.hxx:462
int index_type
Type of indices.
Definition: draw.hxx:39
InList inarcs(BaseNode bnode) const
Return a list of incoming arcs of a node.
Definition: Net.hxx:1138
A dynamic time expanded network.
Definition: Net.hxx:458
Result
Return states of the shortest path computation.
Definition: Net.hxx:492
Iterator over the outgoing arcs of a base node.
Definition: Net.hxx:803
index_type Arc
Type of arcs.
Definition: Net.hxx:474
The namespace of DynG.
Definition: draw.hxx:36
Iterator over the incoming arcs of a node.
Definition: Net.hxx:1122
DyngError(const std::string &msg)
Constructor with error message.
Definition: Net.hxx:76