dengzedong
2025-02-20 c4422acb43c8297343b904ce6a0065c2aca6e04d
备份mpk资源文件
已添加7个文件
324 ■■■■■ 文件已修改
iailab-module-model/iailab-module-model-biz/src/main/resources/mpkResources/IAILMDK/common/Environment.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/resources/mpkResources/IAILMDK/utils/AlgsUtils.java 230 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/resources/mpkResources/libs/IAIL.MDK.Mid.Windows.dll 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/resources/mpkResources/libs/IAIL.MDK.Mid.Windows.lib 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/resources/mpkResources/libs/IAIL.MDK.Mid.Windowsbak.dll 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/resources/mpkResources/libs/status_code.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/resources/mpkResources/libs/version.xml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/resources/mpkResources/IAILMDK/common/Environment.java
对比新文件
@@ -0,0 +1,44 @@
package iail.mdk.model.common;
/**
 * @Description
 * @Author Forrest
 * @Mail 1255187617@qq.com
 * @Date 2021/1/12
 */
public class Environment {
    private native int jniInit();
    private native int jniIsInit();
    private native void jniRelease();
    private native int statusCode();
    /**
     * 初始化环境
     */
    public int init() {
        return jniInit();
    }
    /**
     * 获取初始化状态
     */
    public int isInit() {
        return jniIsInit();
    }
    /**
     * 释放资源
     */
    public void release() {
        jniRelease();
    }
    /**
     *校验机器码
     * */
//    public int checkMachineCode(String mCode){
//        return statusCode();
//    }
}
iailab-module-model/iailab-module-model-biz/src/main/resources/mpkResources/IAILMDK/utils/AlgsUtils.java
对比新文件
@@ -0,0 +1,230 @@
package iail.mdk.model.utils;
import java.util.HashMap;
import java.util.Map;
/**
 * @description:
 * @author: dzd
 * @date: 2024/10/12 9:19
 **/
public class AlgsUtils {
    private HashMap<String, Object> model = new HashMap();
    private HashMap<String, Object> eval_pre = new HashMap();
    private HashMap<String, Object> train_result_models = new HashMap();
    public AlgsUtils() {
    }
    public HashMap<String, Object> createPredictHashmap(HashMap<String, Object> models) {
        if (models.containsKey("model")) {
            String aaa;
            if (((String) ((HashMap) models.get("model")).get("param1")).isEmpty()) {
                aaa = "error";
                this.model.put("param1", aaa);
            } else {
                aaa = (String) ((HashMap) models.get("model")).get("param1");
                this.model.put("param1", aaa);
            }
        } else {
            this.model = models;
        }
        return this.model;
    }
    public HashMap<String, Object> createPredictHashmapplus(HashMap<String, Object> models) {
        if (models.containsKey("models")) {
            String aaa;
            if (((String) ((HashMap) models.get("models")).get("paramFile")).isEmpty()) {
                aaa = "error";
                this.model.put("param1", aaa);
            } else {
                aaa = (String) ((HashMap) models.get("models")).get("paramFile");
                this.model.put("paramFile", aaa);
                if (((HashMap) models.get("models")).containsKey("dim")) {
                    Object dim = ((HashMap) models.get("models")).get("dim");
                    this.model.put("dim", dim);
                }
            }
        } else {
            this.model = models;
        }
        return this.model;
    }
    public HashMap<String, Object> reverseModels(HashMap<String, Object> train_result) {
        if (train_result.containsKey("models")) {
            this.train_result_models = (HashMap) train_result.get("models");
            if (((HashMap) train_result.get("models")).containsKey("dim")) {
                double dim = Double.parseDouble((String) ((HashMap) train_result.get("models")).get("dim"));
                this.train_result_models.put("dim", dim);
            }
            train_result.put("models", this.train_result_models);
        }
        return train_result;
    }
    public int[] getColAndRow(double[][] arr) {
        int row = arr.length;
        int col = arr[0].length;
        int[] result = new int[]{row, col};
        return result;
    }
    public double[][] getMathergeArr(double[][] data, double[][] refs) {
        int[] dataRowAndCol = this.getColAndRow(data);
        int rowData = dataRowAndCol[0];
        int colData = dataRowAndCol[1];
        int[] refsRowAndCol = this.getColAndRow(refs);
        int rowrefs = refsRowAndCol[0];
        int colrefs = refsRowAndCol[1];
        double[][] newData = new double[rowData + rowrefs][colData];
        int i;
        int j;
        for (i = 0; i < rowData; ++i) {
            for (j = 0; j < colData; ++j) {
                newData[i][j] = data[i][j];
            }
        }
        for (i = 0; i < rowrefs; ++i) {
            for (j = 0; j < colrefs; ++j) {
                newData[i + rowData][j] = refs[i][j];
            }
        }
        return newData;
    }
    public HashMap<String, Object> reverseResult(HashMap<String, Object> result) {
        if (null == result) {
            return result;
        }
        String code = reverseResultCode(result);
        if (!"100".equals(code)) {
            return result;
        }
        reverseResultValues(result);
        reverseTest(result);
        reverseEval(result);
        reverseOptdParams(result);
        return result;
    }
    private void reverseResultValues(HashMap<String, Object> result) {
        // 将result中的Double数组转为double数组
        if (result.containsKey("result")) {
            HashMap<String, Object> resultValues = (HashMap) result.get("result");
            for (Map.Entry<String, Object> entry : resultValues.entrySet()) {
                if (entry.getValue() instanceof Double[]) {
                    //一维数组
                    Double[] value = (Double[]) entry.getValue();
                    double[] value1 = new double[value.length];
                    for (int i = 0; i < value.length; i++) {
                        Double d = value[i];
                        if (Double.isNaN(d)) {
                            value1[i] = new Double(0.0).doubleValue();
                        } else {
                            value1[i] = d.doubleValue();
                        }
                    }
                    resultValues.put(entry.getKey(),value1);
                }
                if (entry.getValue() instanceof Double[][]) {
                    //二维数组
                    Double[][] value = (Double[][]) entry.getValue();
                    double[][] value1 = new double[value.length][];
                    for (int i = 0; i < value.length; i++) {
                        value1[i] = new double[value[i].length];
                        for (int j = 0; j < value[i].length; j++) {
                            Double d = value[i][j];
                            if (Double.isNaN(d)) {
                                value1[i][j] = new Double(0.0).doubleValue();
                            } else {
                                value1[i][j] = d.doubleValue();
                            }
                        }
                    }
                    resultValues.put(entry.getKey(),value1);
                }
            }
        }
    }
    private String reverseResultCode(HashMap<String, Object> result) {
        String code = result.containsKey("status_code") ? String.valueOf(result.get("status_code")) : "400";
        result.put("status_code", code);
        return code;
    }
    private void reverseTest(HashMap<String, Object> result) {
        if (result.containsKey("test")) {
            HashMap<String, Object> test = (HashMap) result.get("test");
            Double[][] realValue = (Double[][]) test.get("realValue");
            Double[][] predictValue = (Double[][]) test.get("predictValue");
            double[][] realValue1 = new double[realValue.length][2];
            double[][] predictValue1 = new double[predictValue.length][2];
            for (int i = 0; i < realValue.length; i++) {
                for (int j = 0; j < realValue[i].length; j++) {
                    Double d = (Double) realValue[i][j];
                    if (Double.isNaN(d)) {
                        realValue1[i][j] = new Double(0.0).doubleValue();
                    } else {
                        realValue1[i][j] = d.doubleValue();
                    }
                }
            }
            for (int i = 0; i < predictValue.length; i++) {
                for (int j = 0; j < predictValue[i].length; j++) {
                    Double d = (Double) predictValue[i][j];
                    if (Double.isNaN(d)) {
                        predictValue1[i][j] = new Double(0.0).doubleValue();
                    } else {
                        predictValue1[i][j] = d.doubleValue();
                    }
                }
            }
            HashMap<String, double[][]> map = new HashMap<>();
            map.put("realValue", realValue1);
            map.put("predictValue", predictValue1);
            result.put("test", map);
        }
    }
    public void reverseEval(HashMap<String, Object> result) {
        if (result.containsKey("eval")) {
            HashMap<String,Object> eval = (HashMap<String,Object>) result.get("eval");
            HashMap<String, String> evalMap = new HashMap<>(eval.size());
            for (HashMap.Entry<String, Object> entry : eval.entrySet()) {
                evalMap.put(entry.getKey(),String.valueOf(entry.getValue()));
            }
            result.put("eval",evalMap);
        }
    }
    private void reverseOptdParams(HashMap<String, Object> result) {
        if (result.containsKey("paramsopt")) {
            HashMap<String,Object> params = (HashMap<String,Object>) result.get("paramsopt");
            HashMap<String, String> newParams = new HashMap<>(params.size());
            for (HashMap.Entry<String, Object> entry : params.entrySet()) {
                newParams.put(entry.getKey(),String.valueOf(entry.getValue()));
            }
            result.put("optdParams",newParams);
        }
    }
}
iailab-module-model/iailab-module-model-biz/src/main/resources/mpkResources/libs/IAIL.MDK.Mid.Windows.dll
Binary files differ
iailab-module-model/iailab-module-model-biz/src/main/resources/mpkResources/libs/IAIL.MDK.Mid.Windows.lib
Binary files differ
iailab-module-model/iailab-module-model-biz/src/main/resources/mpkResources/libs/IAIL.MDK.Mid.Windowsbak.dll
Binary files differ
iailab-module-model/iailab-module-model-biz/src/main/resources/mpkResources/libs/status_code.xml
对比新文件
@@ -0,0 +1,20 @@
<status-codes>
    <status-code code="100" tips="系统正常运行"/>
    <status-code code="200" tips="算法模块加载失败"/>
    <status-code code="201" tips="算法方法加载失败"/>
    <status-code code="202" tips="类型不匹配"/>
    <status-code code="203" tips="找不到模型存储路径"/>
    <status-code code="204" tips="模型参数文件加载失败"/>
    <status-code code="205" tips="计算过程中的数据或数组维度不匹配"/>
    <status-code code="206" tips="数值错误"/>
    <status-code code="207" tips="第三方库问题"/>
    <status-code code="208" tips="评价指标计算错误"/>
    <status-code code="209" tips="数据长度问题"/>
    <status-code code="210" tips="初始化失败"/>
    <status-code code="211" tips="train/predict函数输入格式错误"/>
    <status-code code="212" tips="train/predict函数输出格式错误"/>
    <status-code code="300" tips="MDK未配置"/>
    <status-code code="301" tips="缺少依赖库"/>
    <status-code code="400" tips="系统异常,未知错误"/>
    <status-code code="401" tips="未能进入 Python"/>
</status-codes>
iailab-module-model/iailab-module-model-biz/src/main/resources/mpkResources/libs/version.xml
对比新文件
@@ -0,0 +1,30 @@
<algorithm-list name="算法版本列表">
<!--    说明:version="0.11" 即现行算法未显式标注版本的算法-->
        <algorithms name = "预测">
        <algorithm name="非周期短期点预测" type="非周期完整数据" fileName="PredAperioComShortPoint" version="2.0"/>
        <algorithm name="类周期短期点预测" type="类周期完整数据" fileName="PredPerioComShortPoint" version="2.0"/>
        <algorithm name="中长期点预测" type="类周期完整数据" fileName="PredPerioComLongPoint" version="0.9.1"/>
        <algorithm name="N型数据集点预测" type="N型" fileName="PredNTypeComShortPoint" version="0.20.0"/>
        <algorithm name="调整用户短期点预测" type="阶跃" fileName="PredStepComShortPoint" version="1.0.5"/>
        <algorithm name="因素预测" type="短期点预测" fileName="PredFactComShortPoint" version="1.1.13"/>
    </algorithms>
    <algorithms name="数据预处理">
        <algorithm name="滤波" fileName="PrepFilter" version="1.2.6"/>
        <algorithm name="数据填补" fileName="PrepDaImput" version="0.12.0"/>
        <algorithm name="异常点检测" fileName="PrepOutDetect" version="1.2.3"/>
        <algorithm name="特征选择" fileName="prepFeaSelect" version="0.9.5"/>
    </algorithms>
    <algorithms name="调度">
        <algorithm name="单介质调度" fileName="scheSingleEgy" version="1.0.1"/>
        <algorithm name="热电调度" fileName="MSCoSchedul" version="1.0.1"/>
        <algorithm name="调度建议" fileName="schedulSuggest" version="1.0.1"/>
    </algorithms>
</algorithm-list>