- java.lang.Object
-
- org.jgrapht.generate.netgen.NetworkGeneratorConfigBuilder
-
public class NetworkGeneratorConfigBuilder extends Object
Builder class for theNetworkGeneratorConfig
. This class perform all the necessary parameter validation and provides meaningful error messages. For the network parameter description and a complete list of parameter constrants, seeNetworkGeneratorConfig
. Use this class to construct instances of theNetworkGeneratorConfig
.- Author:
- Timofey Chudakov
- See Also:
NetworkGenerator
,NetworkGeneratorConfig
-
-
Constructor Summary
Constructors Constructor Description NetworkGeneratorConfigBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NetworkGeneratorConfig
build()
Builds theNetworkGeneratorConfig
.NetworkGeneratorConfigBuilder
setArcNum(int arcNum)
Sets the number of arcs in the network.NetworkGeneratorConfigBuilder
setBipartiteMatchingProblemParams(int nodeNum, int arcNum)
Sets bipartite matching parameter subset.NetworkGeneratorConfigBuilder
setBipartiteMatchingProblemParams(int nodeNum, int arcNum, int minCost, int maxCost)
Sets bipartite matching parameter subset.NetworkGeneratorConfigBuilder
setBipartiteMatchingProblemParams(int nodeNum, int arcNum, int minCost, int maxCost, int percentWithInfCost)
Sets bipartite matching parameter subset.NetworkGeneratorConfigBuilder
setMaxCap(int maxCap)
Sets the arc capacity upper bound.NetworkGeneratorConfigBuilder
setMaxCost(int maxCost)
Sets the arc cost upper bound.NetworkGeneratorConfigBuilder
setMaximumFlowProblemParams(int nodeNum, int arcNum, int supply)
Sets maximum flow network parameter subset.NetworkGeneratorConfigBuilder
setMaximumFlowProblemParams(int nodeNum, int arcNum, int supply, int minCap, int maxCap)
Sets maximum flow network parameter subset.NetworkGeneratorConfigBuilder
setMaximumFlowProblemParams(int nodeNum, int arcNum, int supply, int minCap, int maxCap, int sourceNum, int sinkNum)
Sets maximum flow network parameter subset.NetworkGeneratorConfigBuilder
setMaximumFlowProblemParams(int nodeNum, int arcNum, int supply, int minCap, int maxCap, int sourceNum, int sinkNum, int percentCapacitated)
Sets maximum flow network parameter subset.NetworkGeneratorConfigBuilder
setMinCap(int minCap)
Sets the arc capacity lower bound.NetworkGeneratorConfigBuilder
setMinCost(int minCost)
Sets the arc cost lower bound.NetworkGeneratorConfigBuilder
setNodeNum(int nodeNum)
Sets the number of nodes in the network.NetworkGeneratorConfigBuilder
setParams(int nodeNum, int arcNum, int sourceNum, int sinkNum, int transshipSourceNum, int transshipSinkNum, int totalSupply, int minCap, int maxCap, int minCost, int maxCost, int percentCapacitated, int percentWithInfCost)
Sets all the network parameters.NetworkGeneratorConfigBuilder
setPercentCapacitated(int percentCapacitated)
Sets the percent of arcs to have finite capacity.NetworkGeneratorConfigBuilder
setPercentWithInfCost(int percentWithInfCost)
Sets the percent of arcs to have infinite cost.NetworkGeneratorConfigBuilder
setSinkNum(int sinkNum)
Sets the number of sinks in the network.NetworkGeneratorConfigBuilder
setSourceNum(int sourceNum)
Sets the number of sources in the network.NetworkGeneratorConfigBuilder
setTotalSupply(int totalSupply)
Sets the total supply of the network.NetworkGeneratorConfigBuilder
setTSinkNum(int tSinkNum)
Sets the number of transshipment sinks in the network.NetworkGeneratorConfigBuilder
setTSourceNum(int tSourceNum)
Sets the number of transshipment sources in the network.
-
-
-
Method Detail
-
build
public NetworkGeneratorConfig build()
Builds theNetworkGeneratorConfig
. This method performs remaining parameter validation.- Returns:
- the constructed
NetworkGeneratorConfig
.
-
setParams
public NetworkGeneratorConfigBuilder setParams(int nodeNum, int arcNum, int sourceNum, int sinkNum, int transshipSourceNum, int transshipSinkNum, int totalSupply, int minCap, int maxCap, int minCost, int maxCost, int percentCapacitated, int percentWithInfCost)
Sets all the network parameters.- Parameters:
nodeNum
- number of nodes in the networkarcNum
- number of arcs in the networksourceNum
- number of sources in the networksinkNum
- number of sinks in the networktransshipSourceNum
- number of transshipment sources in the networktransshipSinkNum
- number of transshipment sinks in the networktotalSupply
- total supply of the networkminCap
- arc capacity lower boundmaxCap
- arc capacity upper boundminCost
- arc cost lower boundmaxCost
- arc cost upper boundpercentCapacitated
- percent of arcs to have finite capacitypercentWithInfCost
- percent of arcs to have infinite cost- Returns:
- this object
-
setMaximumFlowProblemParams
public NetworkGeneratorConfigBuilder setMaximumFlowProblemParams(int nodeNum, int arcNum, int supply)
Sets maximum flow network parameter subset. The values of minCap and maxCap are set to 1, the values ofsourceNum
andsinkNum
are set to 1 and the value of thepercentCapacitated
is set to 100.- Parameters:
nodeNum
- number of nodes in the networkarcNum
- number of arcs in the networksupply
- total supply of the network- Returns:
- this object
-
setMaximumFlowProblemParams
public NetworkGeneratorConfigBuilder setMaximumFlowProblemParams(int nodeNum, int arcNum, int supply, int minCap, int maxCap)
Sets maximum flow network parameter subset. The values ofsourceNum
andsinkNum
are set to 1 and the value of thepercentCapacitated
is set to 100.- Parameters:
nodeNum
- number of nodes in the networkarcNum
- number of arcs in the networksupply
- total supply of the networkminCap
- arc capacity lower boundmaxCap
- arc capacity upper bound- Returns:
- this object
-
setMaximumFlowProblemParams
public NetworkGeneratorConfigBuilder setMaximumFlowProblemParams(int nodeNum, int arcNum, int supply, int minCap, int maxCap, int sourceNum, int sinkNum)
Sets maximum flow network parameter subset. The value of thepercentCapacitated
is set to 100.- Parameters:
nodeNum
- number of nodes in the networkarcNum
- number of arcs in the networksupply
- total supply of the networkminCap
- arc capacity lower boundmaxCap
- arc capacity upper boundsourceNum
- number of source in the networksinkNum
- number of sinks in the network- Returns:
- this object
-
setMaximumFlowProblemParams
public NetworkGeneratorConfigBuilder setMaximumFlowProblemParams(int nodeNum, int arcNum, int supply, int minCap, int maxCap, int sourceNum, int sinkNum, int percentCapacitated)
Sets maximum flow network parameter subset.- Parameters:
nodeNum
- number of nodes in the networkarcNum
- number of arcs in the networksupply
- total supply of the networkminCap
- arc capacity lower boundmaxCap
- arc capacity upper boundsourceNum
- number of source in the networksinkNum
- number of sinks in the networkpercentCapacitated
- percent of arcs to have finite capacity- Returns:
- this object
-
setBipartiteMatchingProblemParams
public NetworkGeneratorConfigBuilder setBipartiteMatchingProblemParams(int nodeNum, int arcNum)
Sets bipartite matching parameter subset. The values of theminCost
andmaxCost
are set to 1, the value of thepercentWithInfCost
is set to 0.- Parameters:
nodeNum
- number of nodes in the networkarcNum
- number of arcs in the network- Returns:
- this object
-
setBipartiteMatchingProblemParams
public NetworkGeneratorConfigBuilder setBipartiteMatchingProblemParams(int nodeNum, int arcNum, int minCost, int maxCost)
Sets bipartite matching parameter subset. The value of thepercentWithInfCost
is set to 0.- Parameters:
nodeNum
- number of nodes in the networkarcNum
- number of arcs in the networkminCost
- arc cost lower boundmaxCost
- arc cost upper bound- Returns:
- this object
-
setBipartiteMatchingProblemParams
public NetworkGeneratorConfigBuilder setBipartiteMatchingProblemParams(int nodeNum, int arcNum, int minCost, int maxCost, int percentWithInfCost)
Sets bipartite matching parameter subset.- Parameters:
nodeNum
- number of nodes in the networkarcNum
- number of arcs in the networkminCost
- arc cost lower boundmaxCost
- arc cost upper boundpercentWithInfCost
- percent of arcs to have infinite cost- Returns:
- this object
-
setNodeNum
public NetworkGeneratorConfigBuilder setNodeNum(int nodeNum)
Sets the number of nodes in the network.- Parameters:
nodeNum
- the number of nodes in the network.- Returns:
- this object.
-
setArcNum
public NetworkGeneratorConfigBuilder setArcNum(int arcNum)
Sets the number of arcs in the network.- Parameters:
arcNum
- the number of arcs in the network.- Returns:
- this object.
-
setSourceNum
public NetworkGeneratorConfigBuilder setSourceNum(int sourceNum)
Sets the number of sources in the network.- Parameters:
sourceNum
- the number of sources in the network.- Returns:
- this object
-
setSinkNum
public NetworkGeneratorConfigBuilder setSinkNum(int sinkNum)
Sets the number of sinks in the network.- Parameters:
sinkNum
- the number of sinks in the network.- Returns:
- this object.
-
setTSourceNum
public NetworkGeneratorConfigBuilder setTSourceNum(int tSourceNum)
Sets the number of transshipment sources in the network.- Parameters:
tSourceNum
- the number of transshipment sources in the network.- Returns:
- this object.
-
setTSinkNum
public NetworkGeneratorConfigBuilder setTSinkNum(int tSinkNum)
Sets the number of transshipment sinks in the network.- Parameters:
tSinkNum
- the number of transshipment sinks in the network.- Returns:
- this object.
-
setTotalSupply
public NetworkGeneratorConfigBuilder setTotalSupply(int totalSupply)
Sets the total supply of the network.- Parameters:
totalSupply
- the total supply of the network.- Returns:
- this object.
-
setMinCap
public NetworkGeneratorConfigBuilder setMinCap(int minCap)
Sets the arc capacity lower bound.- Parameters:
minCap
- the arc capacity lower bound.- Returns:
- this object.
-
setMaxCap
public NetworkGeneratorConfigBuilder setMaxCap(int maxCap)
Sets the arc capacity upper bound.- Parameters:
maxCap
- the arc capacity upper bound.- Returns:
- this object.
-
setMinCost
public NetworkGeneratorConfigBuilder setMinCost(int minCost)
Sets the arc cost lower bound.- Parameters:
minCost
- the arc cost lower bound.- Returns:
- this object.
-
setMaxCost
public NetworkGeneratorConfigBuilder setMaxCost(int maxCost)
Sets the arc cost upper bound.- Parameters:
maxCost
- the arc cost upper bound.- Returns:
- this object.
-
setPercentCapacitated
public NetworkGeneratorConfigBuilder setPercentCapacitated(int percentCapacitated)
Sets the percent of arcs to have finite capacity.- Parameters:
percentCapacitated
- the percent of arcs to have finite capacity.- Returns:
- this object.
-
setPercentWithInfCost
public NetworkGeneratorConfigBuilder setPercentWithInfCost(int percentWithInfCost)
Sets the percent of arcs to have infinite cost.- Parameters:
percentWithInfCost
- the percent of arcs to have infinite cost.- Returns:
- this object.
-
-