mascoptCplex.algos.networks
Class RoutingCplexFlowCapacityMax

java.lang.Object
  |
  +--mascoptCplex.algos.networks.RoutingCplexFlowCapacityMax
Direct Known Subclasses:
RoutingCplexFlowCapacityConstrains, RoutingCplexFlowCapacitySum

public class RoutingCplexFlowCapacityMax
extends Object

The RoutingCplexFlowCapacityMax class provides an algorithm to compute and solve the problem of multi-flow with capacity. The algorithm solve the problem with Cplex, so it use the NetworkCplexFlow object. In first, the algorithm add to Cplex the constraints of capacity and the objective of problem, then solve the problem with Cplex. The objective is to minimize the maximun flow of system. Note that result represent the optimality or the realisability of the problem.


Field Summary
static double INFINITY
          Infinity.
 boolean result
          The boolean is true if the problem has a optimal or feasible solution.
 
Constructor Summary
RoutingCplexFlowCapacityMax(NetworkCplexFlow f)
          Constructor, initialize the network and the flow system.
 
Method Summary
 void addCapacity()
          Adds the constraints of capacity to the Cplex problem.
 Double averageFlow()
          return the average flow of an arc of problem.
 Double getArcFlow(Arc arc)
          Give the flow passing by an arc
 DiPath getChain(Arc r)
          Returns the chain with the computed flow.
 DiPathSet getPathSolution(Arc r)
          return a DiPath satisfaying the request r.
 DiPathSet getSingleChains(Arc r)
          Returns single chains with the computed flow.
 Double maxFlow()
          return the maximum flow of the arcs of problem.
 Double minFlow()
          return the minimum flow of the arcs of problem.
 void objectiveRouting()
          Add the objective to the Cplex problem.
 void printSolution()
          print the solution paths for all requests
 void saveSolutionPath()
          Save chains of all requests of networks in the HashMap allPathSolution of routingFlow Use the fonction getsingleChains(Arc )
 boolean solve()
          Initialize the system flow, add the objective and constraints of capacity, so solve the flow on the network.
 Double sumFlow()
          return the sum of flow of all the arcs of problem.
 Double sumLengthPaths()
          return the sum of length of the paths.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

result

public boolean result
The boolean is true if the problem has a optimal or feasible solution.


INFINITY

public static double INFINITY
Infinity.

Constructor Detail

RoutingCplexFlowCapacityMax

public RoutingCplexFlowCapacityMax(NetworkCplexFlow f)
Constructor, initialize the network and the flow system.

Parameters:
f - is the data of network.
Method Detail

objectiveRouting

public void objectiveRouting()
Add the objective to the Cplex problem. The objective minimize the maximun capacity of network.


addCapacity

public void addCapacity()
Adds the constraints of capacity to the Cplex problem. The capacity of each arc is determined by the HashMap capacityFlow of routingFlow.


solve

public boolean solve()
Initialize the system flow, add the objective and constraints of capacity, so solve the flow on the network.

Returns:
true if the Cplex solution is optimal or feasible.

getChain

public DiPath getChain(Arc r)
Returns the chain with the computed flow. The flow amount can be found on the chain returned, getting the value called FLOW_ALLOCATED which is stored with a Double (so, use the getDouValue). This method returns a multi chain. If you want a collection of chain, use the method getSingleChains. You can also ask to each arc of the path returned what amount of flow it carry. Use the string FLOW_ALLOCATED to do this using the methode getDouValue().

Parameters:
r - the Arcrepresenting the request.
Returns:
a chain satisfaying r.

getSingleChains

public DiPathSet getSingleChains(Arc r)
Returns single chains with the computed flow. The flow amount can be found on the chain returned, getting the value called FLOW_ALLOCATED which is stored with a Double (so, use the getDouValue). You can also ask to each arc of the path returned what amount of flow it carry. Use the string FLOW_ALLOCATED to do this using the methode getDouValue().

Parameters:
r - the Arcrepresenting the request to satisfy.
Returns:
an HashSet containing all the paths satisfaying r.

saveSolutionPath

public void saveSolutionPath()
Save chains of all requests of networks in the HashMap allPathSolution of routingFlow Use the fonction getsingleChains(Arc )


printSolution

public void printSolution()
print the solution paths for all requests


getPathSolution

public DiPathSet getPathSolution(Arc r)
return a DiPath satisfaying the request r.

Parameters:
r - the Arcrepresenting the request.
Returns:
a diPath containing the paths satisfaying request r.

getArcFlow

public Double getArcFlow(Arc arc)
Give the flow passing by an arc

Parameters:
arc - The arc
Returns:
The quantity of flow passing by the arc

maxFlow

public Double maxFlow()
return the maximum flow of the arcs of problem.

Returns:
a Double which is the maximum flow

minFlow

public Double minFlow()
return the minimum flow of the arcs of problem.

Returns:
a Double which is the minimum flow.

sumFlow

public Double sumFlow()
return the sum of flow of all the arcs of problem.

Returns:
a Double which is the sum of flow.

averageFlow

public Double averageFlow()
return the average flow of an arc of problem.

Returns:
a Double which is the average flow.

sumLengthPaths

public Double sumLengthPaths()
return the sum of length of the paths.

Returns:
a Double which is the sum of length of the paths.