1 #line 620 "reducciones.nw"
2 # ifndef TPL_NET_SUP_DEM_H
3 # define TPL_NET_SUP_DEM_H
5 # include <tpl_netgraph.H>
9 #line 586 "reducciones.nw"
14 template <
typename Node_Info,
typename F_Type =
long>
30 :
Net_Node<Node_Info, F_Type>(node_info), supply_flow(0) { }
35 :
Net_Node<Node_Info, F_Type>(*node), supply_flow(node->supply_flow) { }
38 #line 629 "reducciones.nw"
55 template <
class NodeT = Net_Sup_Dem_Node<Empty_Class,
double>,
56 class ArcT = Net_Arc<Empty_Class,
double> >
74 #line 675 "reducciones.nw"
88 p->supply_flow = supply;
104 #line 719 "reducciones.nw"
115 return super_source != NULL or super_sink != NULL;
118 #line 739 "reducciones.nw"
146 throw std::domain_error(
"Auxiliar net is already computed");
147 if (this->residual_net)
148 throw std::domain_error(
"Residual net has been already computed");
155 Node * p = it.get_current();
156 if (p->supply_flow > 0)
158 if (p->out_cap < p->supply_flow)
159 throw std::range_error(gnu::autosprintf(
"Supply flow in node at %p is "
160 "greater than out capacity", p));
163 else if (p->supply_flow < 0)
165 if (p->in_cap < -p->supply_flow)
166 throw std::range_error(gnu::autosprintf(
"Supply flow in node at %p is "
167 "smaller than in capacity", p));
183 #line 825 "reducciones.nw"
185 #line 833 "reducciones.nw"
196 throw std::domain_error(
"Auxiliar net has not been computed");
199 Node * p = it.get_current();
200 Flow_Type & supply_flow = p->supply_flow;
201 if (supply_flow == 0)
203 if (supply_flow > 0 and p->out_flow < supply_flow)
205 else if (supply_flow < 0 and p->in_flow < -supply_flow)
230 Node * p = it.get_current();
231 Flow_Type & supply_flow = p->supply_flow;
232 if (supply_flow == 0)
234 if (supply_flow > 0 and p->out_flow < supply_flow)
236 else if (supply_flow < 0 and p->in_flow < -supply_flow)
240 #line 895 "reducciones.nw"
256 if (supply > 0 and p->out_cap < supply)
257 throw std::range_error(gnu::autosprintf(
"Supply flow in node at %p is "
258 "greater than out capacity", p));
259 else if (supply < 0 and p->in_cap < -supply)
260 throw std::range_error(gnu::autosprintf(
"Supply flow in node at %p is "
261 "smaller than in capacity", p));
262 p->supply_flow = supply;
264 #line 922 "reducciones.nw"
269 throw std::domain_error(
"Auxiliar net has not been computed");
271 if (this->residual_net)
276 if (super_source != NULL)
281 if (super_sink != NULL)
287 #line 664 "reducciones.nw"
292 # endif // TPL_NET_SUP_DEM_H
bool exist_aux_net() const
Retorna true si la red auxiliar ya ha sido creada.
Definition: tpl_net_sup_dem.H:113
void unmake_residual_net()
Definition: tpl_netgraph.H:919
Definition: tpl_net_sup_dem.H:57
virtual Arc * insert_arc(Node *src_node, Node *tgt_node, const typename Arc::Arc_Type &arc_info, const Flow_Type &cap, const Flow_Type &flow)
Definition: tpl_netgraph.H:517
F_Type Flow_Type
Tipo que representa el flujo.
Definition: tpl_net_sup_dem.H:19
Net_Sup_Dem_Graph Aux_Net
El tipo de red capacitada auxiliar equivalente.
Definition: tpl_net_sup_dem.H:120
NodeT Node
Tipo de node.
Definition: tpl_net_sup_dem.H:65
Net_Sup_Dem_Node(Net_Sup_Dem_Node *node)
Definition: tpl_net_sup_dem.H:34
void non_feasible_nodes(DynDlist< Node * > &supply_list, DynDlist< Node * > &demand_list)
Definition: tpl_net_sup_dem.H:226
Definition: tpl_dynDlist.H:26
Definition: tpl_net_sup_dem.H:15
void free_aux_net()
Libera memoria de la red extendida.
Definition: tpl_net_sup_dem.H:266
Node * insert_node(const Node_Type &node_info, const Flow_Type &supply=0)
Definition: tpl_net_sup_dem.H:85
Node::Node_Type Node_Type
Tipo de atributo que almacena un nodo.
Definition: tpl_net_sup_dem.H:69
Node * insert_node(const Flow_Type &supply=0)
Definition: tpl_net_sup_dem.H:100
size_t get_in_degree(Node *node) const
Definition: tpl_netgraph.H:238
void next()
Adelanta el iterador una posición.
Definition: filter_iterator.H:143
Net_Sup_Dem_Graph * compute_aux_net()
Definition: tpl_net_sup_dem.H:143
size_t get_out_degree(Node *node) const
Definition: tpl_netgraph.H:242
Net_Sup_Dem_Node(const Node_Info &node_info)
Definition: tpl_net_sup_dem.H:29
Definition: tpl_netgraph.H:205
Definition: tpl_graph.H:814
void set_supply_flow(Node *p, const Flow_Type &supply)
Definition: tpl_net_sup_dem.H:254
Net_Graph< NodeT, ArcT > Net_Class
La clase de red tradicional.
Definition: tpl_net_sup_dem.H:61
Flow_Type & get_supply_flow()
Retorna el valor de provisión del nodo.
Definition: tpl_net_sup_dem.H:23
Node * insert_node()
Definition: tpl_netgraph.H:461
virtual void remove_node(Node *p)
Elimina un nodo de una red de flujo junto con todos sus arcos.
Definition: tpl_netgraph.H:697
ArcT Arc
Tipo de arco.
Definition: tpl_net_sup_dem.H:63
void unmake_super_nodes()
Definition: tpl_netgraph.H:412
Arc::Flow_Type Flow_Type
Tipo que representa la capacidad y el flujo.
Definition: tpl_net_sup_dem.H:67
bool is_feasible() const
Definition: tpl_net_sup_dem.H:193
Definition: tpl_netgraph.H:141
T & append(const T &item)
Definition: tpl_dynDlist.H:106
Arc::Arc_Type Arc_Type
Tipo de atributo que almacena un arco.
Definition: tpl_net_sup_dem.H:71