This commit is contained in:
= 2020-05-24 16:29:52 +02:00
parent c52bd1cb85
commit aa9ac3ce5d
3 changed files with 37 additions and 10 deletions

View File

@ -89,9 +89,9 @@ FUZZIFY lastMatchesResultBetweenAverage
END_FUZZIFY
DEFUZZIFY prediction
TERM przegrana := (-1,1) (0,0);
TERM remis := (-0.5,0) (0,1) (0.5,0);
TERM wygrana := (0,0) (1,1);
TERM przegrana := (0,1) (10,0);
TERM remis := (10,0) (15,1) (20,0);
TERM wygrana := (20,0) (30,1);
DEFAULT := 0;
END_DEFUZZIFY
@ -100,10 +100,15 @@ RULEBLOCK No1
ACT : MIN;
ACCU : MAX;
RULE 1: IF goalkeeperForm IS zla AND possessionAverage IS malo THEN prediction IS przegrana;
RULE 2: IF possessionAverage IS duzo AND shootsOnTargetAverage IS duzo THEN prediction IS wygrana;
RULE 3: IF lastMatchesResultBetweenAverage IS slabo OR lastMatchesResultBetweenAverage IS przecietnie OR lastMatchesResultBetweenAverage IS dobrze THEN prediction IS remis;
RULE 4: IF goalkeeperForm IS znakomita AND shootsOnTargetAverage IS malo THEN prediction IS przegrana;
RULE 1: IF goalkeeperForm IS znakomita AND shootsOnTargetAverage IS malo THEN prediction IS przegrana;
RULE 2: IF goalkeeperForm IS zla AND possessionAverage IS malo THEN prediction IS przegrana;
RULE 3: IF possessionAverage IS duzo AND shootsOnTargetAverage IS duzo THEN prediction IS wygrana;
RULE 4: IF lastMatchesResultBetweenAverage IS slabo OR lastMatchesResultBetweenAverage IS przecietnie OR lastMatchesResultBetweenAverage IS dobrze THEN prediction IS remis;
RULE 5: IF goalkeeperForm IS znakomita AND goalsLostAverage IS malo OR goalsLostAverage IS przecietnie AND goalsAverage IS malo OR goalsAverage IS przecietnie THEN prediction IS remis;
RULE 6: IF lastMatchesResultBetweenAverage IS bardzo_slabo OR lastMatchesResultBetweenAverage IS slabo AND goalsLostAverage IS przecietnie OR goalsLostAverage IS duzo THEN prediction IS przegrana;
RULE 7: IF shootsOnTargetAverage IS duzo and possessionAverage IS duzo THEN prediction IS wygrana;
END_RULEBLOCK
END_FUNCTION_BLOCK

View File

@ -10,6 +10,7 @@ import net.sourceforge.jFuzzyLogic.plot.JFuzzyChart;
import net.sourceforge.jFuzzyLogic.rule.Variable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@ -30,7 +31,15 @@ public class Prediction {
public static void make() {
// Load from 'FCL' file
FIS fis = Fuzzy.jFuzzyLogic.getFis();
//FIS fis = Fuzzy.jFuzzyLogic.getFis();
File file = new File("Prediction.fcl");
String fileName = file.getAbsolutePath().replace("Prediction.fcl", "src\\main\\java\\com\\resultprediction\\polishekstraklasa\\Predictions\\Prediction.fcl");
FIS fis = FIS.load(fileName, true);
if (fis == null) {
System.err.println("Can't load file: '" + fileName + "'");
System.exit(1);
}
// Pokazuje reguly
FunctionBlock functionBlock = fis.getFunctionBlock(null);
JFuzzyChart.get().chart(functionBlock);
@ -39,6 +48,18 @@ public class Prediction {
for (com.resultprediction.polishekstraklasa.Predictions.Variable variable : variables){
fis.setVariable(variable.getName(), variable.getValue());
}
/*
fis.setVariable("goalkeeperForm", 85);
fis.setVariable("formationAgainstForm", 60);
fis.setVariable("shootsOnTargetAverage", 8);
fis.setVariable("possessionAverage", 80);
fis.setVariable("goalsAverage", 2);
fis.setVariable("goalsLostAverage", 0);
fis.setVariable("redCardsAverage", 0.1);
fis.setVariable("penaltyAreaEntriesAverage", 1);
fis.setVariable("penaltiesAverage", 0.1);
fis.setVariable("lastMatchesResultAverage", 8);
fis.setVariable("lastMatchesResultBetweenAverage", 8);*/
// Wylicza zbiory rozmyte
fis.evaluate();
@ -52,7 +73,8 @@ public class Prediction {
// Drukuje reguly
//System.out.println(fis);
System.out.println("Prediction:" + fis.getVariable("prediction"));
System.out.println(fis);
System.out.println("Napiwek:" + fis.getVariable("prediction"));
variables.clear();
}
}

View File

@ -31,7 +31,7 @@ public class PredictionsApplication {
ConfigurableApplicationContext context = builder.run(args);
Fuzzy fuzzy = new Fuzzy();
//Fuzzy fuzzy = new Fuzzy();
}
}