// single public KarmE(int setForBackWards, int setRelationStyle, int setEpsilon, int setMaxGap, string dsFilePath, bool runKarma, int setMaxTirpSize, int eFrst, int eLast) { parallel = false; // setParallel; //karmalegologi = setKarmaLegoLogi; //DateTime starTime = DateTime.Now; forBackWards = setForBackWards; relations_style = setRelationStyle; epsilon = setEpsilon; max_gap = setMaxGap; maxTirpSize = setMaxTirpSize; read_tids_file(eFrst, eLast, dsFilePath, ref entityTISs, ref toncepts); //KLC.NUM_OF_ENTITIES, dsFilePath, ref entityTISs, ref toncepts); entitieSize = entityTISs.Count; min_ver_sup = 0; // ((double)setMinVerSup / 100) * entitieSize; entitiesKarmaVec = new entityKarma[entitieSize]; int eIdx = 0; foreach (int eKey in entityTISs.Keys) { entitiesKarmaVec[eIdx++] = new entityKarma(eKey); } print = 1; // setPrint; if (forBackWards == KLC.backwardsMining) { logiRelsIndxs = new int[KLC.MAX_TIRP_TONCEPTS_SIZE][]; logiRelsIndxs[0 /*2*/] = new int[1] { 0 }; logiRelsIndxs[1 /*3*/] = new int[3] { 2, 1, 0 }; logiRelsIndxs[2 /*4*/] = new int[6] { 5, 4, 2, 3, 1, 0 }; logiRelsIndxs[3 /*5*/] = new int[10] { 9, 8, 5, 7, 4, 2, 6, 3, 1, 0 }; logiRelsIndxs[4 /*6*/] = new int[15] { 14, 13, 9, 12, 8, 5, 11, 7, 4, 2, 10, 6, 3, 1, 0 }; logiRelsIndxs[5 /*7*/] = new int[21] { 20, 19, 14, 18, 13, 9, 17, 12, 8, 5, 16, 11, 7, 4, 2, 15, 10, 6, 3, 1, 0 }; logiRelsIndxs[6 /*8*/] = new int[28] { 27, 26, 20, 25, 19, 14, 24, 18, 13, 9, 23, 17, 12, 8, 5, 22, 16, 11, 7, 4, 2, 21, 15, 10, 6, 3, 1, 0 }; logiRelsIndxs[7 /*9*/] = new int[36] { 35, 34, 27, 33, 26, 20, 32, 25, 19, 14, 31, 24, 18, 13, 9, 30, 23, 17, 12, 8, 5, 29, 22, 16, 11, 7, 4, 2, 28, 21, 15, 10, 6, 3, 1, 0 }; logiRelsIndxs[8 /*10*/] = new int[45] { 44, 43, 35, 42, 34, 27, 41, 33, 26, 20, 40, 32, 25, 19, 14, 39, 31, 24, 18, 13, 9, 38, 30, 23, 17, 12, 8, 5, 37, 29, 22, 16, 11, 7, 4, 2, 36, 28, 21, 15, 10, 6, 3, 1, 0 }; } if (runKarma == true) { RunKarmaRun(); } }
/* * public static void runKLD(int legologi, int rels, int epsilon, int maxGap, int minSup, string klFile, bool seTrans, string mXprntD, string outFolder, string outFile, ref string karmaDTime, ref string legoDTime) * { * DateTime starTime = DateTime.Now; * KarmaLegoLib.KarmaD kD = new KarmaD(legologi, KLC.RELSTYLE_ALLEN7, epsilon, maxGap, minSup, klFile, seTrans); * kD.RunKarmaRun(); * if(mXprntD != "") * kD.printMatrixEntries(mXprntD); * karmaDTime = (DateTime.Now - starTime).Minutes + ":" + (DateTime.Now - starTime).Seconds; * starTime = DateTime.Now; * kD.RunLegoALL(outFolder, seTrans, KLC.KL_PRINT_YES, outFile); * legoDTime = (DateTime.Now - starTime).Minutes + ":" + (DateTime.Now - starTime).Seconds; * starTime = DateTime.Now; * kD = null; * }*/ //public KarmaD(int setKarmaLegoLogi, int setRelationStyle, int setEpsilon, int setMaxGap, int setMinVerSup, string dsFilePath, bool seTrans) public KarmE(int setForBackWards, int setRelationStyle, int setEpsilon, int setMaxGap, double setMinVerSup, double setMinHrzSup, string dsFilePath, bool seTrans, bool setHS1, int setPrint, bool setParallel, ref string runTime, int setMaxTIRPSize, int eLast = KLC.NUM_OF_ENTITIES, int eFrst = 0) { parallel = setParallel; //karmalegologi = setKarmaLegoLogi; DateTime starTime = DateTime.Now; forBackWards = setForBackWards; relations_style = setRelationStyle; epsilon = setEpsilon; max_gap = setMaxGap; maxTirpSize = setMaxTIRPSize; //read_tids_file(0, KLC.NUM_OF_ENTITIES, dsFilePath, ref entityTISs, ref toncepts); read_tids_file(eFrst, eLast, dsFilePath, ref entityTISs, ref toncepts); entitieSize = entityTISs.Count; min_ver_sup = ((double)setMinVerSup / 100) * entitieSize; min_hrz_sup = setMinHrzSup; entitiesKarmaVec = new entityKarma[entitieSize]; int eIdx = 0; foreach (int eKey in entityTISs.Keys) { entitiesKarmaVec[eIdx++] = new entityKarma(eKey); } //glblMxRelsVerSupport = new int[KLC.NUM_OF_SYMBOLS][][]; //glblMxRelsHrzSupport = new int[KLC.NUM_OF_SYMBOLS][][]; //for (int i = 0; i < KLC.NUM_OF_SYMBOLS; i++) //{ // glblMxRelsVerSupport[i] = new int[KLC.NUM_OF_SYMBOLS][]; // glblMxRelsHrzSupport[i] = new int[KLC.NUM_OF_SYMBOLS][]; // for (int j = 0; j < KLC.NUM_OF_SYMBOLS; j++) // { // glblMxRelsVerSupport[i][j] = new int[relations_style]; // glblMxRelsHrzSupport[i][j] = new int[relations_style]; // } //} print = setPrint; string tesTrans; if (seTrans) { KLC.LoadTransitionTableALLEN7(ref transition);//load transition table transition = null; } if (forBackWards == KLC.backwardsMining) { logiRelsIndxs = new int[KLC.MAX_TIRP_TONCEPTS_SIZE][]; logiRelsIndxs[0 /*2*/] = new int[1] { 0 }; logiRelsIndxs[1 /*3*/] = new int[3] { 2, 1, 0 }; logiRelsIndxs[2 /*4*/] = new int[6] { 5, 4, 2, 3, 1, 0 }; logiRelsIndxs[3 /*5*/] = new int[10] { 9, 8, 5, 7, 4, 2, 6, 3, 1, 0 }; logiRelsIndxs[4 /*6*/] = new int[15] { 14, 13, 9, 12, 8, 5, 11, 7, 4, 2, 10, 6, 3, 1, 0 }; logiRelsIndxs[5 /*7*/] = new int[21] { 20, 19, 14, 18, 13, 9, 17, 12, 8, 5, 16, 11, 7, 4, 2, 15, 10, 6, 3, 1, 0 }; logiRelsIndxs[6 /*8*/] = new int[28] { 27, 26, 20, 25, 19, 14, 24, 18, 13, 9, 23, 17, 12, 8, 5, 22, 16, 11, 7, 4, 2, 21, 15, 10, 6, 3, 1, 0 }; logiRelsIndxs[7 /*9*/] = new int[36] { 35, 34, 27, 33, 26, 20, 32, 25, 19, 14, 31, 24, 18, 13, 9, 30, 23, 17, 12, 8, 5, 29, 22, 16, 11, 7, 4, 2, 28, 21, 15, 10, 6, 3, 1, 0 }; logiRelsIndxs[8 /*10*/] = new int[45] { 44, 43, 35, 42, 34, 27, 41, 33, 26, 20, 40, 32, 25, 19, 14, 39, 31, 24, 18, 13, 9, 38, 30, 23, 17, 12, 8, 5, 37, 29, 22, 16, 11, 7, 4, 2, 36, 28, 21, 15, 10, 6, 3, 1, 0 }; } if (runTime != "") { RunKarmaRun(); } DateTime endTime = DateTime.Now; runTime = endTime.Subtract(starTime).TotalMilliseconds.ToString(); }