diff --git a/src/main/java/ru/ulstu/fc/config/SecurityConfiguration.java b/src/main/java/ru/ulstu/fc/config/SecurityConfiguration.java index a07da1e..2bdf064 100644 --- a/src/main/java/ru/ulstu/fc/config/SecurityConfiguration.java +++ b/src/main/java/ru/ulstu/fc/config/SecurityConfiguration.java @@ -31,7 +31,7 @@ public class SecurityConfiguration { .headers(headers -> headers.frameOptions(HeadersConfigurer.FrameOptionsConfig::sameOrigin)) .csrf(AbstractHttpConfigurer::disable) .authorizeHttpRequests(auth -> - auth.requestMatchers("/").permitAll() + auth.requestMatchers("/", "get-inference").permitAll() .requestMatchers(permittedUrls).permitAll() .requestMatchers("/swagger-ui.html").hasAuthority(UserRoleConstants.ADMIN) .anyRequest().authenticated()) diff --git a/src/main/java/ru/ulstu/fc/rule/service/FuzzyInferenceService.java b/src/main/java/ru/ulstu/fc/rule/service/FuzzyInferenceService.java index c8d251c..7c3cefd 100644 --- a/src/main/java/ru/ulstu/fc/rule/service/FuzzyInferenceService.java +++ b/src/main/java/ru/ulstu/fc/rule/service/FuzzyInferenceService.java @@ -24,6 +24,7 @@ import ru.ulstu.fc.rule.model.ProjectInferenceData; import ru.ulstu.fc.rule.model.Variable; import ru.ulstu.fc.rule.model.dto.VariableValueDto; +import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.Map; @@ -52,7 +53,7 @@ public class FuzzyInferenceService { } private List getDemoRules() { - return List.of( + return Arrays.asList( String.format(RULE_TEMPLATE, "возраст", "молодой", "доход", "высокий", "средний"), String.format(RULE_TEMPLATE, "возраст", "средний", "доход", "высокий", "большой"), String.format(RULE_TEMPLATE, "возраст", "старый", "доход", "средний", "средний") @@ -64,7 +65,7 @@ public class FuzzyInferenceService { input.setName(variable.getName()); input.setDescription(""); variable.getFuzzyTerms().sort(Comparator.comparing(FuzzyTerm::getCrispValue)); - input.setRange(0, variable.getFuzzyTerms().get(variable.getFuzzyTerms().size() - 1).getCrispValue()); + input.setRange(0, variable.getFuzzyTerms().getLast().getCrispValue()); input.setEnabled(true); input.setLockValueInRange(false); double prev = 0; @@ -83,7 +84,7 @@ public class FuzzyInferenceService { final OutputVariable output = new OutputVariable(); output.setName(variable.getName()); output.setDescription(""); - output.setRange(0, variable.getFuzzyTerms().get(variable.getFuzzyTerms().size() - 1).getCrispValue()); + output.setRange(0, variable.getFuzzyTerms().getLast().getCrispValue()); output.setEnabled(true); output.setAggregation(new Maximum()); output.setDefuzzifier(new WeightedAverage()); @@ -117,7 +118,6 @@ public class FuzzyInferenceService { mamdani.setImplication(new AlgebraicProduct()); mamdani.setActivation(new General()); rules.forEach(r -> mamdani.addRule(Rule.parse(r, engine))); - mamdani.addRule(new Rule()); return mamdani; } @@ -141,18 +141,18 @@ public class FuzzyInferenceService { public List getFuzzyInference(Map vals) { return getFuzzyInference(getDemoRules(), vals, - List.of(new Variable("возраст", List.of( + Arrays.asList(new Variable("возраст", Arrays.asList( new FuzzyTerm("молодой", 35.0), new FuzzyTerm("средний", 60.0), new FuzzyTerm("старый", 100.0)) ), - new Variable("доход", List.of( + new Variable("доход", Arrays.asList( new FuzzyTerm("небольшой", 35000.0), new FuzzyTerm("средний", 100000.0), new FuzzyTerm("высокий", 500000.0)) ) ), - List.of(new Variable("кредит", List.of( + Arrays.asList(new Variable("кредит", Arrays.asList( new FuzzyTerm("небольшой", 20000.0), new FuzzyTerm("средний", 100000.0), new FuzzyTerm("большой", 1000000.0)))) diff --git a/src/main/resources/logging.properties b/src/main/resources/logging.properties new file mode 100644 index 0000000..37cfff2 --- /dev/null +++ b/src/main/resources/logging.properties @@ -0,0 +1,2 @@ +org.apache.tomcat.level=INFO +org.apache.tomcat.util.net.level=WARNING \ No newline at end of file diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index b1a1070..c576b74 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -50,12 +50,15 @@ -
+
Размер кредита:
Степень принадлежности:
+
+ Нет результата +