#91 -- Add markup page menu item #94

Merged
romanov73 merged 29 commits from 91-markup into master 2023-04-23 23:43:14 +04:00
Showing only changes of commit 6823f34997 - Show all commits

View File

@ -57,20 +57,11 @@ public class FuzzyInferenceService {
input.setName(key); input.setName(key);
input.setDescription(""); input.setDescription("");
input.setEnabled(true); input.setEnabled(true);
double delta = antecedentValues.size() > 1
? 2.0 / (antecedentValues.size() - 1)
: 2.0;
input.setRange(-1, 1); input.setRange(-1, 1);
input.setLockValueInRange(false); input.setLockValueInRange(false);
for (int i = 0; i < antecedentValues.size(); i++) { input.addTerm(new Triangle("спад", -1, 0));
input.addTerm( input.addTerm(new Triangle("стабильно", -0.1, 0.1));
new Triangle( input.addTerm(new Triangle("рост", 0, 1));
antecedentValues.get(i).getAntecedentValue(),
-1 + i * delta - 0.5 * delta,
-1 + i * delta + delta + 0.5 * delta
)
);
}
engine.addInputVariable(input); engine.addInputVariable(input);
}); });
@ -114,6 +105,7 @@ public class FuzzyInferenceService {
List<AntecedentValue> antecedentValues, List<AntecedentValue> antecedentValues,
Map<String, Double> variableValues) { Map<String, Double> variableValues) {
validateVariables(variableValues, dbRules); validateVariables(variableValues, dbRules);
variableValues.entrySet().forEach(e -> System.out.println(e.getKey() + " " + e.getValue()));
Engine engine = getFuzzyEngine(); Engine engine = getFuzzyEngine();
List<Integer> consequentValues = dbRules.stream().map(DbRule::getId).collect(Collectors.toList()); List<Integer> consequentValues = dbRules.stream().map(DbRule::getId).collect(Collectors.toList());
engine.addRuleBlock(getRuleBlock(engine, dbRules, variableValues, antecedentValues, consequentValues)); engine.addRuleBlock(getRuleBlock(engine, dbRules, variableValues, antecedentValues, consequentValues));