java.lang.Object
org.jgrapht.generate.netgen.NetworkGeneratorConfigBuilder
Builder class for the
NetworkGeneratorConfig
. 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, see NetworkGeneratorConfig
. Use
this class to construct instances of the NetworkGeneratorConfig
.- Author:
- Timofey Chudakov
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds theNetworkGeneratorConfig
.setArcNum
(int arcNum) Sets the number of arcs in the network.setBipartiteMatchingProblemParams
(int nodeNum, int arcNum) Sets bipartite matching parameter subset.setBipartiteMatchingProblemParams
(int nodeNum, int arcNum, int minCost, int maxCost) Sets bipartite matching parameter subset.setBipartiteMatchingProblemParams
(int nodeNum, int arcNum, int minCost, int maxCost, int percentWithInfCost) Sets bipartite matching parameter subset.setMaxCap
(int maxCap) Sets the arc capacity upper bound.setMaxCost
(int maxCost) Sets the arc cost upper bound.setMaximumFlowProblemParams
(int nodeNum, int arcNum, int supply) Sets maximum flow network parameter subset.setMaximumFlowProblemParams
(int nodeNum, int arcNum, int supply, int minCap, int maxCap) Sets maximum flow network parameter subset.setMaximumFlowProblemParams
(int nodeNum, int arcNum, int supply, int minCap, int maxCap, int sourceNum, int sinkNum) Sets maximum flow network parameter subset.setMaximumFlowProblemParams
(int nodeNum, int arcNum, int supply, int minCap, int maxCap, int sourceNum, int sinkNum, int percentCapacitated) Sets maximum flow network parameter subset.setMinCap
(int minCap) Sets the arc capacity lower bound.setMinCost
(int minCost) Sets the arc cost lower bound.setNodeNum
(int nodeNum) Sets the number of nodes in the network.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.setPercentCapacitated
(int percentCapacitated) Sets the percent of arcs to have finite capacity.setPercentWithInfCost
(int percentWithInfCost) Sets the percent of arcs to have infinite cost.setSinkNum
(int sinkNum) Sets the number of sinks in the network.setSourceNum
(int sourceNum) Sets the number of sources in the network.setTotalSupply
(int totalSupply) Sets the total supply of the network.setTSinkNum
(int tSinkNum) Sets the number of transshipment sinks in the network.setTSourceNum
(int tSourceNum) Sets the number of transshipment sources in the network.
-
Constructor Details
-
NetworkGeneratorConfigBuilder
public NetworkGeneratorConfigBuilder()
-
-
Method Details
-
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
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
Sets the number of nodes in the network.- Parameters:
nodeNum
- the number of nodes in the network.- Returns:
- this object.
-
setArcNum
Sets the number of arcs in the network.- Parameters:
arcNum
- the number of arcs in the network.- Returns:
- this object.
-
setSourceNum
Sets the number of sources in the network.- Parameters:
sourceNum
- the number of sources in the network.- Returns:
- this object
-
setSinkNum
Sets the number of sinks in the network.- Parameters:
sinkNum
- the number of sinks in the network.- Returns:
- this object.
-
setTSourceNum
Sets the number of transshipment sources in the network.- Parameters:
tSourceNum
- the number of transshipment sources in the network.- Returns:
- this object.
-
setTSinkNum
Sets the number of transshipment sinks in the network.- Parameters:
tSinkNum
- the number of transshipment sinks in the network.- Returns:
- this object.
-
setTotalSupply
Sets the total supply of the network.- Parameters:
totalSupply
- the total supply of the network.- Returns:
- this object.
-
setMinCap
Sets the arc capacity lower bound.- Parameters:
minCap
- the arc capacity lower bound.- Returns:
- this object.
-
setMaxCap
Sets the arc capacity upper bound.- Parameters:
maxCap
- the arc capacity upper bound.- Returns:
- this object.
-
setMinCost
Sets the arc cost lower bound.- Parameters:
minCost
- the arc cost lower bound.- Returns:
- this object.
-
setMaxCost
Sets the arc cost upper bound.- Parameters:
maxCost
- the arc cost upper bound.- Returns:
- this object.
-
setPercentCapacitated
Sets the percent of arcs to have finite capacity.- Parameters:
percentCapacitated
- the percent of arcs to have finite capacity.- Returns:
- this object.
-
setPercentWithInfCost
Sets the percent of arcs to have infinite cost.- Parameters:
percentWithInfCost
- the percent of arcs to have infinite cost.- Returns:
- this object.
-