org.jacop.constraints.netflow.simplex

## Class Arc

• ```public final class Arc
extends Object```
A directed, residual arc in the graph.
Version:
4.6
Author:
• ### Field Summary

Fields
Modifier and Type Field and Description
`int` `capacity`
The unused (i.e.
`ArcCompanion` `companion`
The arc companion for constraint API.
`int` `cost`
The cost of the Arc cost
`boolean` `forward`
whether this arc is a forward arc or a residual arc
`Node` `head`
The head of the arc (where the arc points to).
`int` `index`
Index in lower arcs array
`Arc` `sister`
The flow of an arc is the residual capacity of its sister arc.
• ### Constructor Summary

Constructors
Constructor and Description
```Arc(Node tail, Node head)```
Special constructor to create artificial arcs.
```Arc(Node tail, Node head, int cost, int lowerCapacity, int upperCapacity)```
General constructor to create arcs.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`void` `addFlow(int delta)`
`void` `clear()`
Clears an artificial arc
`ArcCompanion` `getCompanion()`
`boolean` `hasCompanion()`
`boolean` `isInCut(boolean forward)`
`long` `longCost()`
`String` `name()`
`int` `reducedCost()`
Computes the cost of this arc considering node potentials.
`void` ```set(int newCost, int newCapacity)```
Initializes an artificial arc
`Node` `tail()`
`String` `toFlow()`
`String` `toString()`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`
• ### Field Detail

`public final Node head`
The head of the arc (where the arc points to). The head of an arc is the tail of its sister arc.
• #### cost

`public int cost`
The cost of the Arc cost
• #### capacity

`public int capacity`
The unused (i.e. residual) capacity of the arc
• #### sister

`public final Arc sister`
The flow of an arc is the residual capacity of its sister arc.
• #### index

`public int index`
Index in lower arcs array
• #### companion

`public ArcCompanion companion`
The arc companion for constraint API. Only forward arcs have a companion, residual arcs do not.
• #### forward

`public boolean forward`
whether this arc is a forward arc or a residual arc
• ### Constructor Detail

• #### Arc

```public Arc(Node tail,
Special constructor to create artificial arcs. Should NOT be used in a model. Models should use (or subclass) a NetworkBuilder instead. A NetworkBuilder provides various addArc methods to create arcs more conveniently.
Parameters:
`tail` - tail of the arc
`head` - head of the arc
• #### Arc

```public Arc(Node tail,
int cost,
int lowerCapacity,
int upperCapacity)```
General constructor to create arcs. Models should consider to use (or subclass) a NetworkBuilder instead. A NetworkBuilder provides various addArc methods to create arcs more conveniently.
Parameters:
`tail` - tail of the arc
`head` - head of the arc
`cost` - cost-per-unit of the arc
`lowerCapacity` - lower capacity of the arc
`upperCapacity` - upper capacity of the arc
• ### Method Detail

• #### reducedCost

`public int reducedCost()`
Computes the cost of this arc considering node potentials.
Returns:
the reduced cost

`public void addFlow(int delta)`
• #### tail

`public Node tail()`
• #### isInCut

`public boolean isInCut(boolean forward)`
• #### set

```public void set(int newCost,
int newCapacity)```
Initializes an artificial arc
Parameters:
`newCost` - new cost for the arc
`newCapacity` - new capacity for the arc
• #### clear

`public void clear()`
Clears an artificial arc
• #### longCost

`public long longCost()`
Returns:
cost associated with an arc.
• #### toString

`public String toString()`
Overrides:
`toString` in class `Object`
• #### toFlow

`public String toFlow()`
• #### hasCompanion

`public boolean hasCompanion()`
• #### getCompanion

`public ArcCompanion getCompanion()`
• #### name

`public String name()`