public void testWithRandomConstraints3() {
//based on code sarah
//Make Visualiser for chartcreation
// Visualiser vis = new Visualiser("Percentage of failures with increasing number of clauses for SIMPLE constraints",
// "Number of clauses", "Percentage of failures");
Visualiser visTime = new Visualiser("Mean calculation time with increasing number of clauses (max number of variables=max number of constraints",
"Number of clauses", "Mean calculation time");
Random rand = new Random(0);
for (int i = 1; i <= 25; i++) {
// for (int i = 1; i <= 96; i += 5) {
System.out.println("klasse " + i);
//i--> number of constraints (class from i to i+4)
double sumBeam = 0, sumBasic = 0;
for (int k = 1; k <=
100; k++) {
//for each constraint class 100 cp cases
int numberOfConstraints = i;//i + rand.nextInt(i + 3);
int numberOfVariables = (i == 1 ? 1 : (1 + rand.nextInt(i - 1)));//rand.nextInt(i + 3);
int numberOfVariablesPerClause = (i == 1 ? 1 : (1 + rand.nextInt(i - 1)));//rand.nextInt(i + 3);
List<FuzzyLiteral> l = RandomProblemGenerator.getRandomSatisfiableConstraints3(numberOfConstraints, numberOfVariables, 0.5, numberOfVariablesPerClause);
List<FuzzyClause> constraintslist = new ArrayList<FuzzyClause>(); //for beam version
for (FuzzyLiteral f : l) {
constraintslist.add(new FuzzyClause(f));
}
List<FuzzyClause> constraintslist2 = new ArrayList<FuzzyClause>(); //for basic version
for (FuzzyLiteral f : l) {
constraintslist2.add(new FuzzyClause(new FuzzyLiteral(f)));
}
//start beam
double start = System.currentTimeMillis();
CPBeamSolver beam = new CPBeamSolver(constraintslist, 1, 1, 1, 1, 200, 0.0001, 0.5, 100);
beam.findFuzzyModel();
double end = System.currentTimeMillis();
sumBeam += (end - start);
//start basic
start = System.currentTimeMillis();
CPBeamSolver basic = new CPBeamSolver(constraintslist2, 1, 1, 1, 1, 200, 0.0001, 0.5, 100);
basic.findFuzzyModelTest();
end = System.currentTimeMillis();
sumBasic += (end - start);
}
visTime.setValue("Beam IP-1", 0.0 + i, sumBeam / 100);//((0.0 + i) / 4) + 1, sumBeam / 100);
visTime.setValue("Basic", 0.0 + i, sumBasic / 100);//((0.0 + i) / 4) + 1, sumBasic / 100);
}
visTime.saveChart("FilesPat/BeamVersusBasic(NoTransformationToBasicConstraints)_NumberOfConstraints(maxVariables=maxConstraints)");
}