WIP: страницы для правил #62
@ -80,7 +80,7 @@ public class FuzzyInferenceService {
|
|||||||
output.setName(OUTPUT_VARIABLE_NAME);
|
output.setName(OUTPUT_VARIABLE_NAME);
|
||||||
output.setDescription("");
|
output.setDescription("");
|
||||||
output.setEnabled(true);
|
output.setEnabled(true);
|
||||||
output.setRange(-0.1, antecedentValues.size() + 0.1);
|
output.setRange(-0.1, consequentValues.size() + 0.1);
|
||||||
output.setAggregation(new Maximum());
|
output.setAggregation(new Maximum());
|
||||||
output.setDefuzzifier(new Centroid(100));
|
output.setDefuzzifier(new Centroid(100));
|
||||||
output.setDefaultValue(Double.NaN);
|
output.setDefaultValue(Double.NaN);
|
||||||
@ -98,7 +98,6 @@ public class FuzzyInferenceService {
|
|||||||
mamdani.setDisjunction(new BoundedSum());
|
mamdani.setDisjunction(new BoundedSum());
|
||||||
mamdani.setImplication(new AlgebraicProduct());
|
mamdani.setImplication(new AlgebraicProduct());
|
||||||
mamdani.setActivation(new Highest());
|
mamdani.setActivation(new Highest());
|
||||||
getRulesFromDb(variableValues).forEach(System.out::println);
|
|
||||||
getRulesFromDb(variableValues).forEach(r -> mamdani.addRule(Rule.parse(r, engine)));
|
getRulesFromDb(variableValues).forEach(r -> mamdani.addRule(Rule.parse(r, engine)));
|
||||||
return mamdani;
|
return mamdani;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package ru.ulstu.extractor.ts.service;
|
package ru.ulstu.extractor.ts.service;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -12,6 +13,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import ru.ulstu.extractor.branch.model.Branch;
|
import ru.ulstu.extractor.branch.model.Branch;
|
||||||
import ru.ulstu.extractor.http.HttpService;
|
import ru.ulstu.extractor.http.HttpService;
|
||||||
import ru.ulstu.extractor.http.JsonTimeSeries;
|
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.TimeSeries;
|
||||||
import ru.ulstu.extractor.ts.model.TimeSeriesType;
|
import ru.ulstu.extractor.ts.model.TimeSeriesType;
|
||||||
import ru.ulstu.extractor.ts.model.TimeSeriesValue;
|
import ru.ulstu.extractor.ts.model.TimeSeriesValue;
|
||||||
@ -114,9 +116,13 @@ public class TimeSeriesService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Double getLastTimeSeriesTendency(TimeSeries ts) {
|
public Double getLastTimeSeriesTendency(TimeSeries ts) {
|
||||||
//JSONObject response = httpService.post(TIME_SERIES_TENDENCY_URL, new JSONObject(new SmoothingTimeSeries(ts)));
|
if (ts != null && ts.getValues().size() > 5) {
|
||||||
|
JSONObject response = httpService.post(TIME_SERIES_TENDENCY_URL, new JSONObject(new SmoothingTimeSeries(ts)));
|
||||||
LOG.debug("Успешно отправлен на сервис сглаживания");
|
LOG.debug("Успешно отправлен на сервис сглаживания");
|
||||||
//response.get("timeSeries");
|
response.get("timeSeries");
|
||||||
|
JSONArray jsonArray = response.getJSONObject("timeSeries").getJSONArray("values");
|
||||||
|
return jsonArray.getJSONObject(jsonArray.length() - 1).getDouble("value");
|
||||||
|
}
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user