test_class.declarator: LOGGER = LoggerFactory.getLogger(KargerMinCutVariationTest.class)
test_class.modifier: private static final
test_class.original_string: private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(KargerMinCutVariationTest.class);
test_class.type: org.slf4j.Logger
test_class.var_name: LOGGER
test_class.file: org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/targetallocation/criteria/minexternalconnections/KargerMinCutVariationTest.java
test_class.identifier: KargerMinCutVariationTest
test_class.superclass: extends TestWithGitBackedRepository
test_case.body: @Test
      public void performanceTest() {
          ServiceTemplateId id = new ServiceTemplateId("http://www.winery.opentosca.org/test/targetallocation/servicetemplates",
              "MinExternalConnectionsTest2", false);
          TopologyWrapper topology = new TopologyWrapper(repository.getElement(id).getTopologyTemplate());
          ConnectsToGraph connectsToGraph = new ConnectsToGraph(topology);
          KargerMinCutVariation kargerMinCutVariation = new KargerMinCutVariation(connectsToGraph);
          List<ConnectsToGraph> results = new ArrayList<>(kargerMinCutVariation.computeTargetLabelPartitions());
  
          // testing a monte carlo algorithm doesn't always work
          if (results.size() != 4 || results.get(0).getEdges().size() != 4) {
              LOGGER.debug("Monte Carlo Algorithm produced wrong result");
              return;
          }
  
          assertEquals(results.size(), 4);
          assertEquals(results.get(0).getEdges().size(), 4);
          assertEquals(results.get(1).getEdges().size(), 4);
          assertEquals(results.get(2).getEdges().size(), 4);
          assertEquals(results.get(3).getEdges().size(), 4);
      }
test_case.class_method_signature: KargerMinCutVariationTest.performanceTest()
test_case.full_signature: @Test public void performanceTest()
test_case.identifier: performanceTest
test_case.invocations: getTopologyTemplate getElement computeTargetLabelPartitions size size getEdges get debug assertEquals size assertEquals size getEdges get assertEquals size getEdges get assertEquals size getEdges get assertEquals size getEdges get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void performanceTest()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(KargerMinCutVariation.class)
focal_class.modifier: private static
focal_class.original_string: private static org.slf4j.Logger LOGGER = LoggerFactory.getLogger(KargerMinCutVariation.class);
focal_class.type: org.slf4j.Logger
focal_class.var_name: LOGGER
focal_class.declarator: original
focal_class.modifier: private
focal_class.original_string: private ConnectsToGraph original;
focal_class.type: ConnectsToGraph
focal_class.var_name: original
focal_class.declarator: current
focal_class.modifier: private
focal_class.original_string: private ConnectsToGraph current;
focal_class.type: ConnectsToGraph
focal_class.var_name: current
focal_class.declarator: repetitions
focal_class.modifier: private
focal_class.original_string: private int repetitions;
focal_class.type: int
focal_class.var_name: repetitions
focal_class.declarator: random = new Random()
focal_class.modifier: private
focal_class.original_string: private Random random = new Random();
focal_class.type: Random
focal_class.var_name: random
focal_class.file: org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/targetallocation/criteria/minexternalconnections/KargerMinCutVariation.java
focal_class.identifier: KargerMinCutVariation
focal_class.class_method_signature: KargerMinCutVariation.KargerMinCutVariation(ConnectsToGraph graph)
focal_class.full_signature: public  KargerMinCutVariation(ConnectsToGraph graph)
focal_class.identifier: KargerMinCutVariation
focal_class.modifiers: public
focal_class.parameters: (ConnectsToGraph graph)
focal_class.signature:  KargerMinCutVariation(ConnectsToGraph graph)
focal_class.class_method_signature: KargerMinCutVariation.computeTargetLabelPartitions()
focal_class.full_signature: public Set<ConnectsToGraph> computeTargetLabelPartitions()
focal_class.identifier: computeTargetLabelPartitions
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Set<ConnectsToGraph>
focal_class.signature: Set<ConnectsToGraph> computeTargetLabelPartitions()
focal_class.class_method_signature: KargerMinCutVariation.minCut()
focal_class.full_signature: private void minCut()
focal_class.identifier: minCut
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void minCut()
focal_class.class_method_signature: KargerMinCutVariation.getRandomEdge()
focal_class.full_signature: private ConnectsToGraph.Edge getRandomEdge()
focal_class.identifier: getRandomEdge
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: ConnectsToGraph.Edge
focal_class.signature: ConnectsToGraph.Edge getRandomEdge()
focal_class.class_method_signature: KargerMinCutVariation.contract(ConnectsToGraph.Edge edgeToContract)
focal_class.full_signature: private void contract(ConnectsToGraph.Edge edgeToContract)
focal_class.identifier: contract
focal_class.modifiers: private
focal_class.parameters: (ConnectsToGraph.Edge edgeToContract)
focal_class.return: void
focal_class.signature: void contract(ConnectsToGraph.Edge edgeToContract)
focal_class.class_method_signature: KargerMinCutVariation.merge(ConnectsToGraph.Node nodeToMergeInto, ConnectsToGraph.Node nodeToMerge)
focal_class.full_signature: private void merge(ConnectsToGraph.Node nodeToMergeInto, ConnectsToGraph.Node nodeToMerge)
focal_class.identifier: merge
focal_class.modifiers: private
focal_class.parameters: (ConnectsToGraph.Node nodeToMergeInto, ConnectsToGraph.Node nodeToMerge)
focal_class.return: void
focal_class.signature: void merge(ConnectsToGraph.Node nodeToMergeInto, ConnectsToGraph.Node nodeToMerge)
focal_class.class_method_signature: KargerMinCutVariation.reassignEdges(ConnectsToGraph.Node nodeToMergeInto, ConnectsToGraph.Node nodeToMerge)
focal_class.full_signature: private void reassignEdges(ConnectsToGraph.Node nodeToMergeInto, ConnectsToGraph.Node nodeToMerge)
focal_class.identifier: reassignEdges
focal_class.modifiers: private
focal_class.parameters: (ConnectsToGraph.Node nodeToMergeInto, ConnectsToGraph.Node nodeToMerge)
focal_class.return: void
focal_class.signature: void reassignEdges(ConnectsToGraph.Node nodeToMergeInto, ConnectsToGraph.Node nodeToMerge)
focal_method.body: public Set<ConnectsToGraph> computeTargetLabelPartitions() {
          Set<ConnectsToGraph> best = new HashSet<>();
          int bestMinCut = Integer.MAX_VALUE;
          int currentMinCut;
  
          for (int i = 0; i < repetitions; i++) {
              current = new ConnectsToGraph(original);
              minCut();
              currentMinCut = current.getEdges().size();
  
              if (currentMinCut < bestMinCut) {
                  bestMinCut = currentMinCut;
                  best.clear();
                  best.add(current);
              } else if (currentMinCut == bestMinCut) {
                  best.add(current);
              }
          }
          LOGGER.debug("Minimum cut of " + bestMinCut +
              " found for " + best.size() + " possibilities in " +
              repetitions + " repetitions");
          return best;
      }
focal_method.class_method_signature: KargerMinCutVariation.computeTargetLabelPartitions()
focal_method.full_signature: public Set<ConnectsToGraph> computeTargetLabelPartitions()
focal_method.identifier: computeTargetLabelPartitions
focal_method.invocations: minCut size getEdges clear add add debug size
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: Set<ConnectsToGraph>
focal_method.signature: Set<ConnectsToGraph> computeTargetLabelPartitions()