#74 -- partially add middle logic
This commit is contained in:
parent
374415e154
commit
301a32d610
@ -3,14 +3,11 @@ package ru.ulstu.extractor;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import ru.ulstu.extractor.rule.service.FuzzyInference;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
public class GitExtractorApplication {
|
||||
public static void main(String[] args) {
|
||||
|
||||
new FuzzyInference().run();
|
||||
SpringApplication.run(GitExtractorApplication.class, args);
|
||||
}
|
||||
}
|
||||
|
@ -10,12 +10,61 @@ import net.sourceforge.jFuzzyLogic.rule.LinguisticTerm;
|
||||
import net.sourceforge.jFuzzyLogic.rule.Variable;
|
||||
import net.sourceforge.jFuzzyLogic.ruleConnection.RuleConnectionMethodAndMin;
|
||||
import net.sourceforge.jFuzzyLogic.ruleImplication.RuleImplicationMethodMin;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.ulstu.extractor.rule.model.AntecedentValue;
|
||||
import ru.ulstu.extractor.rule.model.Rule;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class FuzzyInferenceService {
|
||||
private final RuleService ruleService;
|
||||
private final AntecedentValueService antecedentValueService;
|
||||
|
||||
public FuzzyInferenceService(RuleService ruleService,
|
||||
AntecedentValueService antecedentValueService) {
|
||||
this.ruleService = ruleService;
|
||||
this.antecedentValueService = antecedentValueService;
|
||||
}
|
||||
|
||||
private List<FuzzyRule> getFuzzyRulesFromDb() {
|
||||
List<FuzzyRule> fuzzyRules = new ArrayList<>();
|
||||
//List<Variable> variables = getFuzzyVariables();
|
||||
for (Rule dbRule : ruleService.getList()) {
|
||||
FuzzyRule fuzzyRule = new FuzzyRule(String.format("Fuzzy rule %s", dbRule.getId()));
|
||||
// fuzzyRule.setAntecedents(expression);
|
||||
// fuzzyRule.setConsequents(new LinkedList<>(Collections.singleton(new FuzzyRuleTerm(dbRule.getConsequent(), false))));
|
||||
fuzzyRules.add(fuzzyRule);
|
||||
}
|
||||
return fuzzyRules;
|
||||
}
|
||||
|
||||
private List<Variable> getFuzzyVariablesWithoutMembership() {
|
||||
List<Variable> variables = new ArrayList<>();
|
||||
List<AntecedentValue> antecedentValues = antecedentValueService.getList();
|
||||
for (AntecedentValue antecedentValue : antecedentValues) {
|
||||
variables.add(new Variable(antecedentValue.getAntecedentValue()));
|
||||
}
|
||||
return variables;
|
||||
}
|
||||
|
||||
// private FuzzyRuleExpression getFuzzyRulesAntecedents(TimeSeriesType timeSeriesType1, TimeSeriesType timeSeriesType2) {
|
||||
// return new FuzzyRuleExpression(getFuzzyRuleTerm(), getFuzzyRuleTerm(), new RuleConnectionMethodAndMin());
|
||||
// }
|
||||
|
||||
private FuzzyRuleExpression getFuzzyRuleExpression(FuzzyRuleTerm term1, FuzzyRuleTerm term2) {
|
||||
return new FuzzyRuleExpression(term1, term2, new RuleConnectionMethodAndMin());
|
||||
}
|
||||
|
||||
private FuzzyRuleTerm getFuzzyRuleTerm(Variable variable, String term) {
|
||||
return new FuzzyRuleTerm(variable, term, false);
|
||||
}
|
||||
|
||||
|
||||
public class FuzzyInference {
|
||||
public void run() {
|
||||
FuzzyRule fuzzyRule1 = new FuzzyRule("rule 1");
|
||||
FuzzyRule fuzzyRule2 = new FuzzyRule("rule 2");
|
Loading…
Reference in New Issue
Block a user