mascoptCplex.algos.abstractalgos
Class AddFlowRouting

java.lang.Object
  |
  +--mascoptCplex.algos.abstractalgos.AddFlowRouting
Direct Known Subclasses:
AddFlowRoutingConstrains

public class AddFlowRouting
extends Object

Version:
29/07/2003 This class add a multi-flow on a graph, with a set of requests. This flow is added to a linear program in a IloCplex object. This algorithm has two modes: a static one, which consider request as static requests (i.e. the request size is set on edges) and a "dynamic one" which means that the request size is not constant and is determined by an other cplex variable. The two modes are available, and is easy to use to link the flow with another linear model. For switching between two modes, have a look at useVariableAsRequests. The paths wich are calculated carry a certain amount of flow. You can ask to each path this amount using getDouValue(FLOW_ALLOCATED) method. You can chance the constant FLOW_ALLOCATED if you want. Then, each arc carries some flow: you can ask again to each arc of the path this amount of flow. It is usefull when you have to deals with a multi chain because the flow is split among arcs.
Author:
jflaland@sophia.inria.fr

Field Summary
static double EPSILON
          The epsilon error when computing flow and searching for paths
static String FLOW_ALLOCATED
          The string which is used to store the number of lambdas on a path.
 String FORBIDEN_EDGE
          The string which is used to forbid an edge.
 boolean integerComputation_
          Choice of the type of variables.
static int MAX_FLOW_PER_REQUEST
           
static String REQUEST_SIZE
          The string which is used when searching for the size of request.
 
Constructor Summary
AddFlowRouting(AbstractGraph g, ArcSet requests, ilog.cplex.IloCplex cplex, boolean integerComputation)
          Constructs the AddFlowRouting object.
AddFlowRouting(AbstractGraph g, DiGraph requests, ilog.cplex.IloCplex cplex, boolean integerComputation)
          Constructs the AddFlowRouting object.
 
Method Summary
 void createFlow()
          Add a flow system on the network.
 AbstractPath getChain(Arc r)
          Returns the chain with the computed flow.
 double getDouFlowEdge(AbstractEdge e)
          Give the value representing the total flow on an arc.
 double getDouVarEdgeReq(AbstractEdge e, Arc r)
          Give the value representing the flow on an arc and for a request r.
 ilog.concert.IloLinearNumExpr getFlowEdge(AbstractEdge e)
          Give the variable representing the total flow on an arc.
 AbstractPathSet getSingleChains(Arc r)
          Returns single chains with the computed flow.
 ilog.concert.IloNumVar getVarEdgeReq(AbstractEdge e, Arc r)
          Give the variable representing the flow on an arc and for a request r.
 void useLinearNumExprAsRequests(HashMap correspondance)
          Use this Cplex linear numerical expression as request instead of fixed values.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_FLOW_PER_REQUEST

public static int MAX_FLOW_PER_REQUEST

FORBIDEN_EDGE

public String FORBIDEN_EDGE
The string which is used to forbid an edge. If this string is set to "true" on an edge, no flow is allowed on it.


REQUEST_SIZE

public static String REQUEST_SIZE
The string which is used when searching for the size of request. This string is ignored when using the methode useVariableAsRequests().


EPSILON

public static double EPSILON
The epsilon error when computing flow and searching for paths


FLOW_ALLOCATED

public static String FLOW_ALLOCATED
The string which is used to store the number of lambdas on a path.


integerComputation_

public boolean integerComputation_
Choice of the type of variables. The flow can be written with integer variables or not. By default the flow is computed with real variables.

Constructor Detail

AddFlowRouting

public AddFlowRouting(AbstractGraph g,
                      ArcSet requests,
                      ilog.cplex.IloCplex cplex,
                      boolean integerComputation)
Constructs the AddFlowRouting object.

Parameters:
g - the graph used for the routing.
requests - the requests arc set on the graph.
cplex - the cplex object where to put constraints.

AddFlowRouting

public AddFlowRouting(AbstractGraph g,
                      DiGraph requests,
                      ilog.cplex.IloCplex cplex,
                      boolean integerComputation)
Constructs the AddFlowRouting object.

Parameters:
g - the graph used for the routing.
requests - the requests graph on the graph.
cplex - the cplex object where to put constraints.
Method Detail

createFlow

public void createFlow()
Add a flow system on the network.


getVarEdgeReq

public ilog.concert.IloNumVar getVarEdgeReq(AbstractEdge e,
                                            Arc r)
Give the variable representing the flow on an arc and for a request r.

Parameters:
e - the edge considered.
r - the request considered.
Returns:
the cplex variable.

getDouVarEdgeReq

public double getDouVarEdgeReq(AbstractEdge e,
                               Arc r)
Give the value representing the flow on an arc and for a request r.

Parameters:
e - the edge considered.
r - the request considered.
Returns:
the double variable.

getFlowEdge

public ilog.concert.IloLinearNumExpr getFlowEdge(AbstractEdge e)
Give the variable representing the total flow on an arc.

Parameters:
e - the edge considered.
Returns:
the cplex variable.

getDouFlowEdge

public double getDouFlowEdge(AbstractEdge e)
Give the value representing the total flow on an arc.

Parameters:
e - the edge considered.
Returns:
the double variable.

getChain

public AbstractPath 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 metdho getDouValue().

Parameters:
r - the request to satisfy.
Returns:
a chain satisfaying r.

getSingleChains

public AbstractPathSet 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 metdho getDouValue().

Parameters:
r - the request to satisfy.
Returns:
a set of paths containing all the paths satisfaying r.

useLinearNumExprAsRequests

public void useLinearNumExprAsRequests(HashMap correspondance)
Use this Cplex linear numerical expression as request instead of fixed values. When creating the flow, the integer linear program is written with fixed values read on requests. You may want to use some special variables that you provides via this method. The HashMap contains each request and its numerical linear expression.

Parameters:
correspondance - the HashMap containing each request and the corresponding IloLinearNumExpr.