WIP: страницы для правил #62

Closed
Ghost wants to merge 132 commits from master into 61-rules-pages
2 changed files with 10 additions and 5 deletions
Showing only changes of commit 4d7f0f38b8 - Show all commits

View File

@ -80,7 +80,7 @@ public class FuzzyInferenceService {
output.setName(OUTPUT_VARIABLE_NAME);
output.setDescription("");
output.setEnabled(true);
output.setRange(-0.1, antecedentValues.size() + 0.1);
output.setRange(-0.1, consequentValues.size() + 0.1);
output.setAggregation(new Maximum());
output.setDefuzzifier(new Centroid(100));
output.setDefaultValue(Double.NaN);
@ -98,7 +98,6 @@ public class FuzzyInferenceService {
mamdani.setDisjunction(new BoundedSum());
mamdani.setImplication(new AlgebraicProduct());
mamdani.setActivation(new Highest());
getRulesFromDb(variableValues).forEach(System.out::println);
getRulesFromDb(variableValues).forEach(r -> mamdani.addRule(Rule.parse(r, engine)));
return mamdani;
}

View File

@ -5,6 +5,7 @@
package ru.ulstu.extractor.ts.service;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -12,6 +13,7 @@ import org.springframework.stereotype.Service;
import ru.ulstu.extractor.branch.model.Branch;
import ru.ulstu.extractor.http.HttpService;
import ru.ulstu.extractor.http.JsonTimeSeries;
import ru.ulstu.extractor.http.SmoothingTimeSeries;
import ru.ulstu.extractor.ts.model.TimeSeries;
import ru.ulstu.extractor.ts.model.TimeSeriesType;
import ru.ulstu.extractor.ts.model.TimeSeriesValue;
@ -114,9 +116,13 @@ public class TimeSeriesService {
}
public Double getLastTimeSeriesTendency(TimeSeries ts) {
//JSONObject response = httpService.post(TIME_SERIES_TENDENCY_URL, new JSONObject(new SmoothingTimeSeries(ts)));
LOG.debug("Успешно отправлен на сервис сглаживания");
//response.get("timeSeries");
if (ts != null && ts.getValues().size() > 5) {
JSONObject response = httpService.post(TIME_SERIES_TENDENCY_URL, new JSONObject(new SmoothingTimeSeries(ts)));
LOG.debug("Успешно отправлен на сервис сглаживания");
response.get("timeSeries");
JSONArray jsonArray = response.getJSONObject("timeSeries").getJSONArray("values");
return jsonArray.getJSONObject(jsonArray.length() - 1).getDouble("value");
}
return 0.0;
}
}