Class NetworkGeneratorConfigBuilder

java.lang.Object
org.jgrapht.generate.netgen.NetworkGeneratorConfigBuilder

public class NetworkGeneratorConfigBuilder extends Object
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 Details

    • NetworkGeneratorConfigBuilder

      public NetworkGeneratorConfigBuilder()
  • Method Details

    • build

      public NetworkGeneratorConfig build()
      Builds the NetworkGeneratorConfig. 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 network
      arcNum - number of arcs in the network
      sourceNum - number of sources in the network
      sinkNum - number of sinks in the network
      transshipSourceNum - number of transshipment sources in the network
      transshipSinkNum - number of transshipment sinks in the network
      totalSupply - total supply of the network
      minCap - arc capacity lower bound
      maxCap - arc capacity upper bound
      minCost - arc cost lower bound
      maxCost - arc cost upper bound
      percentCapacitated - percent of arcs to have finite capacity
      percentWithInfCost - 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 of sourceNum and sinkNum are set to 1 and the value of the percentCapacitated is set to 100.
      Parameters:
      nodeNum - number of nodes in the network
      arcNum - number of arcs in the network
      supply - 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 of sourceNum and sinkNum are set to 1 and the value of the percentCapacitated is set to 100.
      Parameters:
      nodeNum - number of nodes in the network
      arcNum - number of arcs in the network
      supply - total supply of the network
      minCap - arc capacity lower bound
      maxCap - 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 the percentCapacitated is set to 100.
      Parameters:
      nodeNum - number of nodes in the network
      arcNum - number of arcs in the network
      supply - total supply of the network
      minCap - arc capacity lower bound
      maxCap - arc capacity upper bound
      sourceNum - number of source in the network
      sinkNum - 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 network
      arcNum - number of arcs in the network
      supply - total supply of the network
      minCap - arc capacity lower bound
      maxCap - arc capacity upper bound
      sourceNum - number of source in the network
      sinkNum - number of sinks in the network
      percentCapacitated - 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 the minCost and maxCost are set to 1, the value of the percentWithInfCost is set to 0.
      Parameters:
      nodeNum - number of nodes in the network
      arcNum - 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 the percentWithInfCost is set to 0.
      Parameters:
      nodeNum - number of nodes in the network
      arcNum - number of arcs in the network
      minCost - arc cost lower bound
      maxCost - 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 network
      arcNum - number of arcs in the network
      minCost - arc cost lower bound
      maxCost - arc cost upper bound
      percentWithInfCost - 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.