From b613c828a7114a2747fb1d5aaca187e3d73da1d2 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Wed, 30 Apr 2025 23:58:57 +0200 Subject: generalize variable DEMO_VARIABLES --- src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java b/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java index 9ef75cf..54dbd5d 100644 --- a/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java +++ b/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java @@ -28,6 +28,9 @@ import com.example.portfolio3.Vertex; /// @see public final class Graph { + /// amount of iterations in demo + private static final int DEMO_ITERATIONS = 1000000; + /// data about combinations as a Graph private AbstractGraph g; @@ -217,11 +220,11 @@ public final class Graph { /// loop through random combinations of sets of modules /// /// @param g sets of disjoint choices as a graph - /// @return best path out of a hundred shuffles + /// @return best path among many random ones public static int goodSolution(final AbstractGraph g) { // number higher than total students int bestPathCost = Integer.MAX_VALUE; - for (int i = 0; i < 10000; i++) { + for (int i = 0; i < DEMO_ITERATIONS; i++) { int cost = solution(g); if (cost < bestPathCost) { // store shortest path -- cgit v1.2.3