(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 12.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 38979, 930] NotebookOptionsPosition[ 38614, 913] NotebookOutlinePosition[ 38962, 928] CellTagsIndexPosition[ 38919, 925] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[TextData[StyleBox["Fuzzy incremental algorithm", FontColor->RGBColor[1, 0, 0]]], "Subsection", CellChangeTimes->{ 3.5854097085807176`*^9, 3.585637218737363*^9, 3.8067555638956704`*^9, { 3.822221900508813*^9, 3.822221903815808*^9}, {3.822222129185065*^9, 3.822222147210169*^9}, 3.8222222736415343`*^9, 3.822224562117813*^9, { 3.8222248851851645`*^9, 3.8222248892227545`*^9}}, ExpressionUUID -> "40480428-912f-47e8-bf93-a11e4a6190d7"], Cell[BoxData[{ RowBox[{ RowBox[{ StyleBox["Input", FontColor->RGBColor[1, 0, 0]], StyleBox[":", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{ RowBox[{"the", " ", "set", " ", "\[ScriptCapitalA]"}], " ", "\[Subset]", " ", SuperscriptBox["\[DoubleStruckCapitalR]", "n"]}], FontColor->RGBColor[0, 0, 1]]}], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"initial", " ", "center", RowBox[{"(", "s", ")"}], " ", StyleBox["cen", FontSlant->"Italic"]}], FontColor->RGBColor[0, 0, 1]], StyleBox[",", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{ RowBox[{"number", " ", "of", " ", "iterations", " ", RowBox[{"K", ".", " ", "Each"}], " ", "additional", " ", "center", " ", "is", " ", "obtained", " ", "solving", " ", "a", " ", "GOP", " ", "using", " ", RowBox[{"Compile", ".", " ", "In"}], " ", "case", " ", "when", " ", "n"}], ">", "2"}], FontColor->RGBColor[0, 0, 1]], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{ RowBox[{ "one", " ", "has", " ", "to", " ", "adapt", " ", "the", " ", "minimizing", " ", "function"}], ";"}], FontColor->RGBColor[0, 0, 1]]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ StyleBox["Output", FontColor->RGBColor[1, 0, 0]], StyleBox[":", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{ "set", " ", "of", " ", "partitions", " ", "and", " ", "values", " ", "of", " ", "FCH"}], FontColor->RGBColor[0, 0, 1]]}], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox["FDB", FontColor->RGBColor[0, 0, 1]], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{ RowBox[{ RowBox[{"and", " ", "FXB", " ", "indexes", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ "if", " ", "the", " ", "original", " ", "partition", " ", "is", " ", "known"}], ",", RowBox[{ "one", " ", "can", " ", "also", " ", "obtain", " ", "the", " ", "Rand", " ", "and", " ", "Jaccard", " ", "indexes"}], ",", RowBox[{ "confusion", " ", "matrix", " ", "and", " ", "Hausdorff", " ", "distance", " ", "between", " ", "the", " ", "sets", " ", "of", " ", "original", " ", "and", " ", "calculated", " ", "cluster", " ", "centers"}]}], ")"}], ".", "Graphical"}], " ", "depictions", " ", "of", " ", "each", " ", "iteration", " ", "are", " ", "presented", " ", "only", " ", "for", " ", "n"}], "=", "2"}], ";"}], FontColor->RGBColor[0, 0, 1]]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ StyleBox["Submodules", FontColor->RGBColor[1, 0, 0]], StyleBox[":", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"FXB", "[", "]"}], FontColor->RGBColor[0, 0, 1]]}], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"FCH", "[", "]"}], FontColor->RGBColor[0, 0, 1]], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"FDB", "[", "]"}], FontColor->RGBColor[0, 0, 1]], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"Hdist", "[", "]"}], FontColor->RGBColor[0, 0, 1]], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"Rand", "[", "]"}], FontColor->RGBColor[0, 0, 1]], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"DIRECT", "[", "]"}], FontColor->RGBColor[0, 0, 1]], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"cmeans", "[", "]"}], FontColor->RGBColor[0, 0, 1]]}], StyleBox[" ", FontColor->RGBColor[0, 0, 1]]}], "\[IndentingNewLine]"}], "Text", CellChangeTimes->{{3.5886541897699375`*^9, 3.5886541909877396`*^9}, { 3.588654263023868*^9, 3.588654339794004*^9}, {3.5917588683674088`*^9, 3.591758869047409*^9}, {3.5917590328866577`*^9, 3.591759044816675*^9}, { 3.5937444692479725`*^9, 3.5937444771129847`*^9}, {3.8067251659311037`*^9, 3.8067252085746784`*^9}, {3.8067252462048798`*^9, 3.806725247420523*^9}, { 3.8067555742205267`*^9, 3.8067555768738213`*^9}, {3.8071002028759546`*^9, 3.807100208919777*^9}, {3.8107927170556965`*^9, 3.8107927208402033`*^9}, { 3.813128996198531*^9, 3.81312899765561*^9}, {3.8131290871131477`*^9, 3.8131291044656687`*^9}, 3.813129162727297*^9, {3.813129217851308*^9, 3.81312926039266*^9}, {3.8131293311074486`*^9, 3.813129508676306*^9}, { 3.8208235288040915`*^9, 3.8208235296679153`*^9}, {3.820823683703711*^9, 3.820823686279229*^9}, {3.822221932773207*^9, 3.822222005492038*^9}, { 3.8222221607470207`*^9, 3.8222221750484905`*^9}, 3.8222222931703854`*^9, { 3.822224586384103*^9, 3.8222246757830353`*^9}, {3.822224705850398*^9, 3.8222247083277173`*^9}, {3.8222249091681223`*^9, 3.8222250402464404`*^9}, {3.822309353020777*^9, 3.822309405751026*^9}, 3.8223094528796563`*^9}, FontSize->12, ExpressionUUID -> "4f6001e5-4731-4da1-898f-f0f23cdb63d0"], Cell[BoxData[ RowBox[{ RowBox[{"FInc", "[", RowBox[{"A_", ",", "z_", ",", "KK_", ",", RowBox[{"Ind_:", "0"}]}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"k", ",", "centri", ",", RowBox[{"m", "=", RowBox[{"Length", "[", "A", "]"}]}], ",", RowBox[{"n", "=", RowBox[{"Length", "[", RowBox[{"A", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], ",", "dom", ",", RowBox[{"TT", "=", "0"}]}], "}"}], ",", "\[IndentingNewLine]", "\t\t\t\t\t", RowBox[{"(*", " ", "Initialization", " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"centri", "=", "z"}], ";", "\[IndentingNewLine]", RowBox[{"PART", "=", RowBox[{"{", "}"}]}], ";", RowBox[{"IndFXB", "=", RowBox[{"IndFCH", "=", RowBox[{"IndFDB", "=", RowBox[{"IndFHV", "=", RowBox[{"IndRand", "=", RowBox[{"IndJaccard", "=", RowBox[{"IndH", "=", RowBox[{"{", "}"}]}]}]}]}]}]}]}], ";", "\[IndentingNewLine]", "\t\t\t\t", RowBox[{"(*", " ", RowBox[{"Iterative", " ", "Procedure"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Print", "[", RowBox[{"\"\<\\nNa postojecih \>\"", ",", RowBox[{"Length", "[", "centri", "]"}], ",", "\"\< centara dodaje se 1 novi\>\""}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Clear", "[", RowBox[{"u", ",", "v"}], "]"}], ";", " ", "\[IndentingNewLine]", RowBox[{"dom", "=", "AG"}], ";", "\[IndentingNewLine]", "\t\t\t\t\t", RowBox[{"(*", " ", "Compile", " ", "*)"}], "\[IndentingNewLine]", RowBox[{"FCompile", "=", RowBox[{"Compile", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"u", ",", "_Real"}], "}"}], ",", RowBox[{"{", RowBox[{"v", ",", "_Real"}], "}"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"Evaluate", "[", RowBox[{"Sum", "[", RowBox[{ RowBox[{"Min", "[", RowBox[{"Append", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"centri", "[", RowBox[{"[", "s", "]"}], "]"}]}], "]"}], "^", "2"}], ",", RowBox[{"{", RowBox[{"s", ",", RowBox[{"Length", "[", "centri", "]"}]}], "}"}]}], "]"}], ",", RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"{", RowBox[{"u", ",", "v"}], "}"}]}], "]"}], "^", "2"}]}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "m"}], "}"}]}], "]"}], " ", "]"}]}], "]"}]}], ";", "\t", "\[IndentingNewLine]", RowBox[{ RowBox[{"F2", "[", RowBox[{"u_", ",", "v_"}], "]"}], ":=", RowBox[{"Apply", "[", RowBox[{"FCompile", ",", RowBox[{"{", RowBox[{"u", ",", "v"}], "}"}]}], "]"}]}], ";", "\t", "\[IndentingNewLine]", "\t\t\t\t\t\t", RowBox[{"(*", " ", RowBox[{ RowBox[{ RowBox[{"Non", " ", "Compile", " ", "\[IndentingNewLine]", RowBox[{"F2", "[", RowBox[{"u_", ",", "v_"}], "]"}]}], ":=", RowBox[{"Sum", "[", RowBox[{ RowBox[{"Min", "[", RowBox[{"Append", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"centri", "[", RowBox[{"[", "s", "]"}], "]"}]}], "]"}], "^", "2"}], ",", RowBox[{"{", RowBox[{"s", ",", RowBox[{"Length", "[", "centri", "]"}]}], "}"}]}], "]"}], ",", RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"{", RowBox[{"u", ",", "v"}], "}"}]}], "]"}], "^", "2"}]}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "m"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", "*)"}], "\[IndentingNewLine]", "\t\t\t\t\t\t\t\t", RowBox[{"(*", " ", "DIRECT", " ", "*)"}], "\[IndentingNewLine]", RowBox[{"minp", "=", RowBox[{ RowBox[{"DIRECT", "[", RowBox[{"F2", ",", "dom", ",", RowBox[{"DMin", "\[Rule]", RowBox[{"10.", "^", RowBox[{"(", RowBox[{"-", "3"}], ")"}]}]}], ",", RowBox[{"MaxIter", "\[Rule]", "50"}], ",", " ", RowBox[{"Eps", "\[Rule]", RowBox[{"10", "^", RowBox[{"(", RowBox[{"-", "4"}], ")"}]}]}]}], "]"}], "//", "Timing"}]}], ";", " ", RowBox[{"min", "=", RowBox[{"minp", "[", RowBox[{"[", "2", "]"}], "]"}]}], ";", RowBox[{"(*", " ", RowBox[{ RowBox[{"Print", "[", RowBox[{"\"\\"", ",", "min"}], "]"}], ";"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"centriN", "=", RowBox[{"Append", "[", RowBox[{"centri", ",", RowBox[{"min", "[", RowBox[{"[", "1", "]"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"Ind", "\[NotEqual]", "0"}], ",", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", "centriN"}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", "\t\t\t\t\t", RowBox[{"(*", " ", RowBox[{ RowBox[{"Poziv", " ", "c"}], "-", "means"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"t1", "=", RowBox[{"Timing", "[", RowBox[{"sol", "=", RowBox[{"cmeans", "[", RowBox[{"A", ",", "centriN", ",", "0"}], "]"}]}], "]"}]}], ";", " ", "\[IndentingNewLine]", RowBox[{"TT", "=", RowBox[{"TT", "+", RowBox[{"minp", "[", RowBox[{"[", "1", "]"}], "]"}], "+", RowBox[{"t1", "[", RowBox[{"[", "1", "]"}], "]"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"k", "=", RowBox[{"Length", "[", RowBox[{"sol", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], ";", " ", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"Ind", "\[NotEqual]", "0"}], ",", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", RowBox[{"sol", "[", RowBox[{"[", "1", "]"}], "]"}]}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"Ind", "\[NotEqual]", "0"}], ",", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", RowBox[{"Fz", "[", RowBox[{"A", ",", RowBox[{"sol", "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"sol", "[", RowBox[{"[", "2", "]"}], "]"}]}], "]"}], ",", "\[IndentingNewLine]", "\"\<; Time (DIRECT+cmeans) = \>\"", ",", RowBox[{"minp", "[", RowBox[{"[", "1", "]"}], "]"}], ",", "\"\<+\>\"", ",", RowBox[{"t1", "[", RowBox[{"[", "1", "]"}], "]"}], ",", "\"\< = \>\"", ",", RowBox[{ RowBox[{"minp", "[", RowBox[{"[", "1", "]"}], "]"}], "+", RowBox[{"t1", "[", RowBox[{"[", "1", "]"}], "]"}]}]}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"fch", "=", RowBox[{"FCH", "[", RowBox[{"A", ",", RowBox[{"sol", "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"sol", "[", RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], ";", RowBox[{"IndFCH", "=", RowBox[{"Append", "[", RowBox[{"IndFCH", ",", "fch"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"fdb", "=", RowBox[{"FDB", "[", RowBox[{"A", ",", RowBox[{"sol", "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"sol", "[", RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], ";", RowBox[{"IndFDB", "=", RowBox[{"Append", "[", RowBox[{"IndFDB", ",", "fdb"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"fxb", "=", RowBox[{"FXB", "[", RowBox[{"A", ",", RowBox[{"sol", "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"sol", "[", RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], ";", RowBox[{"IndFXB", "=", RowBox[{"Append", "[", RowBox[{"IndFXB", ",", "fxb"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"Ind", "\[NotEqual]", "0"}], ",", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", RowBox[{"Length", "[", "centriN", "]"}], ",", "\"\<; FCH=\>\"", ",", "fch", ",", "\"\<; FDB=\>\"", ",", "fdb", ",", "\"\<; FXB=\>\"", ",", "fxb"}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"ind", "=", RowBox[{"RandFrigue", "[", RowBox[{ RowBox[{"sol", "[", RowBox[{"[", "2", "]"}], "]"}], ",", "U0"}], "]"}]}], ";", " ", "\[IndentingNewLine]", RowBox[{"Huel", "=", RowBox[{"Hullermeier", "[", RowBox[{ RowBox[{"sol", "[", RowBox[{"[", "2", "]"}], "]"}], ",", "U0"}], "]"}]}], ";", " ", "\[IndentingNewLine]", RowBox[{"HD", "=", RowBox[{"Hdist", "[", RowBox[{"centers", ",", RowBox[{"sol", "[", RowBox[{"[", "1", "]"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"Ind", "\[NotEqual]", "0"}], ",", RowBox[{"Print", "[", RowBox[{"\"\<{Rand, Jaccard, Hausdorff}: \>\"", ",", RowBox[{"{", RowBox[{"ind", ",", "HD"}], "}"}]}], " ", "]"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"IndRand", "=", RowBox[{"Append", "[", RowBox[{"IndRand", ",", RowBox[{"ind", "[", RowBox[{"[", "1", "]"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"IndJaccard", "=", RowBox[{"Append", "[", RowBox[{"IndJaccard", ",", RowBox[{"ind", "[", RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"IndH", "=", RowBox[{"Append", "[", RowBox[{"IndH", ",", "HD"}], "]"}]}], ";", "\[IndentingNewLine]", " \ ", RowBox[{"(*", " ", "FIGUREE", " ", "*)"}], "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"n", "\[Equal]", "2"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"k", "=", RowBox[{"Length", "[", RowBox[{"sol", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"slc", "=", RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"sol", "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"PlotMarkers", "\[Rule]", RowBox[{"{", RowBox[{"\"\<\[SixPointedStar]\>\"", ",", "20"}], "}"}]}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"{", RowBox[{"Orange", ",", RowBox[{"PointSize", "[", ".025", "]"}], ",", RowBox[{"Opacity", "[", ".9", "]"}]}], "}"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"rad", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Sum", "[", RowBox[{ RowBox[{ RowBox[{"mu", "[", RowBox[{"A", ",", RowBox[{"sol", "[", RowBox[{"[", "1", "]"}], "]"}], ",", "i", ",", "j"}], "]"}], " ", RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{"sol", "[", RowBox[{"[", RowBox[{"1", ",", "j"}], "]"}], "]"}], "-", RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}], "^", "2"}]}], ",", RowBox[{"{", RowBox[{"i", ",", RowBox[{"Length", "[", "A", "]"}]}], "}"}]}], "]"}], "/", RowBox[{"Length", "[", "A", "]"}]}], ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"rad", "=", RowBox[{"Sqrt", "[", "rad", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"sle1", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Graphics", "[", RowBox[{"{", RowBox[{"Gray", ",", RowBox[{"Circle", "[", RowBox[{ RowBox[{"sol", "[", RowBox[{"[", RowBox[{"1", ",", "j"}], "]"}], "]"}], ",", RowBox[{"rad", "[", RowBox[{"[", "j", "]"}], "]"}]}], "]"}]}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\t\t", RowBox[{"(*", " ", RowBox[{ "Ovo", " ", "je", " ", "samo", " ", "za", " ", "crtanje", " ", "sljedeceg", " ", "centra"}], " ", "*)"}], "\[IndentingNewLine]", "\t\t\t\t\t\t", RowBox[{"(*", " ", "Compile", " ", "*)"}], "\[IndentingNewLine]", RowBox[{"Clear", "[", RowBox[{"u", ",", "v", ",", "F2"}], "]"}], ";", " ", "\[IndentingNewLine]", RowBox[{"FCompile", "=", RowBox[{"Compile", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"u", ",", "_Real"}], "}"}], ",", RowBox[{"{", RowBox[{"v", ",", "_Real"}], "}"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"Evaluate", "[", RowBox[{"Sum", "[", RowBox[{ RowBox[{"Min", "[", RowBox[{"Append", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"centriN", "[", RowBox[{"[", "s", "]"}], "]"}]}], "]"}], "^", "2"}], ",", RowBox[{"{", RowBox[{"s", ",", RowBox[{"Length", "[", "centriN", "]"}]}], "}"}]}], "]"}], ",", RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"{", RowBox[{"u", ",", "v"}], "}"}]}], "]"}], "^", "2"}]}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "m"}], "}"}]}], "]"}], " ", "]"}]}], "]"}]}], ";", "\t", "\[IndentingNewLine]", RowBox[{ RowBox[{"F2", "[", RowBox[{"u_", ",", "v_"}], "]"}], ":=", RowBox[{"Apply", "[", RowBox[{"FCompile", ",", RowBox[{"{", RowBox[{"u", ",", "v"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"mini", "=", RowBox[{"DIRECT", "[", RowBox[{"F2", ",", "dom", ",", RowBox[{"DMin", "\[Rule]", RowBox[{"10.", "^", RowBox[{"(", RowBox[{"-", "3"}], ")"}]}]}], ",", RowBox[{"MaxIter", "\[Rule]", "20"}], ",", " ", RowBox[{"Eps", "\[Rule]", RowBox[{"10", "^", RowBox[{"(", RowBox[{"-", "4"}], ")"}]}]}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"nextc", "=", RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"{", RowBox[{"mini", "[", RowBox[{"[", "1", "]"}], "]"}], "}"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"{", RowBox[{"Red", ",", RowBox[{"PointSize", "[", ".04", "]"}], ",", RowBox[{"Opacity", "[", ".8", "]"}]}], "}"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", "\t\t\t\t\t\t\t\t", RowBox[{"(*", " ", "*)"}], "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"Show", "[", RowBox[{"slA", ",", "sle1", ",", "slc", ",", "nextc", ",", RowBox[{"AspectRatio", "\[Rule]", "Automatic"}], ",", RowBox[{"GridLines", "\[Rule]", "Automatic"}], ",", RowBox[{"PlotRange", "\[Rule]", "AG"}], ",", RowBox[{"ImageSize", "\[Rule]", "Small"}]}], "]"}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", "\t\t\t ", "\[IndentingNewLine]", RowBox[{"centri", "=", RowBox[{"sol", "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", " ", "\[IndentingNewLine]", RowBox[{"PART", "=", RowBox[{"Append", "[", RowBox[{"PART", ",", RowBox[{"{", RowBox[{ RowBox[{"sol", "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"sol", "[", RowBox[{"[", "2", "]"}], "]"}]}], "}"}]}], "]"}]}], ";"}], " ", "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"brk", ",", "KK"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", "\t\t\t\t", RowBox[{"(*", " ", "Indexes", " ", "*)"}], "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"Ind", "\[NotEqual]", "0"}], ",", RowBox[{"Print", "[", RowBox[{ "\"\\"", ",", "IndRand", ",", "\"\<\\nJaccard: \>\"", ",", "IndJaccard", ",", "\"\<\\nHausdorff: \>\"", ",", "IndH", ",", "\"\<\\nFXB: \>\"", ",", "IndFXB", ",", "\"\<\\nFCH: \>\"", ",", "IndFCH", ",", "\"\<\\nIndFDB: \>\"", ",", "IndFDB"}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", "TT"}], "]"}], ";", "\[IndentingNewLine]", "\t\t\t\t", RowBox[{"(*", " ", "Figures", " ", "*)"}], "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"Ind", "\[NotEqual]", "0"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"slRand", "=", RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"j", "+", "1"}], ",", RowBox[{"IndRand", "[", RowBox[{"[", "j", "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "KK"}], "}"}]}], "]"}], ",", RowBox[{"Joined", "\[Rule]", "True"}], ",", RowBox[{"AxesOrigin", "\[Rule]", RowBox[{"{", RowBox[{"1", ",", RowBox[{".75", RowBox[{"Min", "[", "IndRand", "]"}]}]}], "}"}]}], ",", RowBox[{"PlotLabel", "->", "\"\\""}], ",", RowBox[{"ImageSize", "\[Rule]", "200"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"slJaccard", "=", RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"j", "+", "1"}], ",", RowBox[{"IndJaccard", "[", RowBox[{"[", "j", "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "KK"}], "}"}]}], "]"}], ",", RowBox[{"Joined", "\[Rule]", "True"}], ",", RowBox[{"AxesOrigin", "\[Rule]", RowBox[{"{", RowBox[{"1", ",", RowBox[{".75", RowBox[{"Min", "[", "IndJaccard", "]"}]}]}], "}"}]}], ",", RowBox[{"PlotLabel", "->", "\"\\""}], ",", RowBox[{"ImageSize", "\[Rule]", "200"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"slH", "=", RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"j", "+", "1"}], ",", RowBox[{"IndH", "[", RowBox[{"[", "j", "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "KK"}], "}"}]}], "]"}], ",", RowBox[{"Joined", "\[Rule]", "True"}], ",", RowBox[{"AxesOrigin", "\[Rule]", RowBox[{"{", RowBox[{"1", ",", RowBox[{".75", RowBox[{"Min", "[", "IndH", "]"}]}]}], "}"}]}], ",", RowBox[{"PlotLabel", "->", "\"\\""}], ",", RowBox[{"ImageSize", "\[Rule]", "200"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"slFXB", "=", RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"j", "+", "1"}], ",", RowBox[{"IndFXB", "[", RowBox[{"[", "j", "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "KK"}], "}"}]}], "]"}], ",", RowBox[{"Joined", "\[Rule]", "True"}], ",", RowBox[{"AxesOrigin", "\[Rule]", RowBox[{"{", RowBox[{"1", ",", RowBox[{".75", RowBox[{"Min", "[", "IndFXB", "]"}]}]}], "}"}]}], ",", RowBox[{"PlotLabel", "->", "\"\\""}], ",", RowBox[{"ImageSize", "\[Rule]", "200"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"slFDB", "=", RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"j", "+", "1"}], ",", RowBox[{"IndFDB", "[", RowBox[{"[", "j", "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "KK"}], "}"}]}], "]"}], ",", RowBox[{"Joined", "\[Rule]", "True"}], ",", RowBox[{"AxesOrigin", "\[Rule]", RowBox[{"{", RowBox[{"1", ",", RowBox[{".75", RowBox[{"Min", "[", "IndFDB", "]"}]}]}], "}"}]}], ",", RowBox[{"PlotLabel", "->", "\"\\""}], ",", RowBox[{"ImageSize", "\[Rule]", "200"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"slFCH", "=", RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"j", "+", "1"}], ",", RowBox[{"IndFCH", "[", RowBox[{"[", "j", "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "KK"}], "}"}]}], "]"}], ",", RowBox[{"Joined", "\[Rule]", "True"}], ",", RowBox[{"AxesOrigin", "\[Rule]", RowBox[{"{", RowBox[{"1", ",", RowBox[{".75", RowBox[{"Min", "[", "IndFCH", "]"}]}]}], "}"}]}], ",", RowBox[{"PlotLabel", "->", "\"\\""}], ",", RowBox[{"ImageSize", "\[Rule]", "200"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"Style", "[", RowBox[{"GraphicsGrid", "[", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"slFXB", ",", "slFDB", ",", "slFCH"}], "}"}], ",", RowBox[{"{", RowBox[{"slRand", ",", "slJaccard", ",", "slH"}], "}"}]}], "}"}], "]"}], "]"}], "]"}]}]}], "]"}], ";", "\t", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ "PART", ",", "IndRand", ",", "IndJaccard", ",", "IndH", ",", "IndFXB", ",", "IndFCH", ",", "IndFDB"}], "}"}]}]}], "\[IndentingNewLine]", "]"}]}]], "Input", CellChangeTimes->{ 3.8070778620207543`*^9, {3.80733446123423*^9, 3.8073344821723948`*^9}, { 3.8073346145618553`*^9, 3.8073346302463217`*^9}, {3.807334698037506*^9, 3.8073347184914775`*^9}, {3.8073349721611814`*^9, 3.8073349736876945`*^9}, {3.8073351196979313`*^9, 3.807335126531347*^9}, { 3.8073351769899893`*^9, 3.8073352053562717`*^9}, {3.8073352984773903`*^9, 3.8073352994493713`*^9}, {3.807335339727481*^9, 3.8073353638525753`*^9}, { 3.8073354162146497`*^9, 3.8073354465280714`*^9}, {3.807335671662741*^9, 3.807335677053487*^9}, {3.807335728274678*^9, 3.8073357329032955`*^9}, { 3.8073358381795793`*^9, 3.807335898447956*^9}, {3.80733594665902*^9, 3.807336000648595*^9}, {3.8073363351640787`*^9, 3.8073363624567394`*^9}, { 3.8073367831195264`*^9, 3.807336798441772*^9}, 3.8073369675357203`*^9, { 3.807337015721323*^9, 3.8073370200457835`*^9}, {3.8073370738850594`*^9, 3.807337162001289*^9}, {3.807337961891038*^9, 3.8073379733665233`*^9}, { 3.807338054022019*^9, 3.807338088743576*^9}, {3.8073382322166643`*^9, 3.8073382393794684`*^9}, {3.8073382879677753`*^9, 3.807338308191094*^9}, { 3.80733840302866*^9, 3.80733840414657*^9}, {3.8073384473515196`*^9, 3.8073384971076527`*^9}, {3.8073387035938787`*^9, 3.8073387104408836`*^9}, {3.807339479623116*^9, 3.807339510226123*^9}, { 3.8073398015564127`*^9, 3.8073398025939713`*^9}, {3.8073564568316755`*^9, 3.8073564637983723`*^9}, {3.8073564996845603`*^9, 3.807356524999864*^9}, { 3.8073568821352215`*^9, 3.8073569199888525`*^9}, {3.807356972072094*^9, 3.8073569971977415`*^9}, {3.8073571818289666`*^9, 3.8073572386848974`*^9}, {3.8073574765727167`*^9, 3.8073574805843406`*^9}, {3.8073575214466944`*^9, 3.80735768877625*^9}, { 3.8073577189030027`*^9, 3.807357737031109*^9}, {3.807357982437543*^9, 3.8073580235909605`*^9}, {3.807358112436776*^9, 3.8073581221479855`*^9}, { 3.8073594490319176`*^9, 3.807359462933496*^9}, {3.807407554951126*^9, 3.8074075558159904`*^9}, {3.807407593591377*^9, 3.807407594301564*^9}, 3.8074077065700765`*^9, 3.8074077472515497`*^9, {3.80740777730503*^9, 3.8074078151683707`*^9}, 3.8074080882620025`*^9, {3.8074082976874766`*^9, 3.807408307053293*^9}, {3.8074083437767057`*^9, 3.8074083441510043`*^9}, 3.8074095488890676`*^9, {3.8074096266895733`*^9, 3.807409632359295*^9}, { 3.8074102411066046`*^9, 3.8074102716703696`*^9}, {3.807410499094212*^9, 3.8074105121670904`*^9}, 3.8074111154401236`*^9, {3.808017487467102*^9, 3.808017508082413*^9}, {3.8080176115850554`*^9, 3.8080176154949474`*^9}, { 3.8080177473288226`*^9, 3.80801782105583*^9}, {3.8080178552514153`*^9, 3.8080179191197767`*^9}, {3.8080179524676123`*^9, 3.8080180602047634`*^9}, {3.8080181874382625`*^9, 3.808018211523689*^9}, { 3.808018296064846*^9, 3.8080184745727005`*^9}, {3.80801851756781*^9, 3.8080185456293344`*^9}, {3.8080186045791636`*^9, 3.808018605966054*^9}, { 3.8080187331960926`*^9, 3.80801882962487*^9}, {3.808019131535711*^9, 3.8080191431406097`*^9}, 3.808019194785721*^9, {3.808019241326264*^9, 3.808019271448477*^9}, {3.8080193505027647`*^9, 3.8080193606922803`*^9}, { 3.8080198026324177`*^9, 3.8080198460557203`*^9}, {3.8080200069616346`*^9, 3.8080200110039377`*^9}, 3.808020056516824*^9, {3.8080200948903847`*^9, 3.808020108515316*^9}, {3.8080217066238422`*^9, 3.80802172380904*^9}, 3.808021764155905*^9, {3.808023363346987*^9, 3.808023391581169*^9}, 3.8080234376664824`*^9, {3.808023468209673*^9, 3.8080234786935167`*^9}, { 3.8080236562922974`*^9, 3.8080236580053577`*^9}, {3.8080237554823675`*^9, 3.808023763145875*^9}, {3.808023980637613*^9, 3.8080240327575626`*^9}, 3.808024180959425*^9, {3.8080243120233583`*^9, 3.8080243406712093`*^9}, { 3.8080243728836546`*^9, 3.808024376728157*^9}, {3.80802441691647*^9, 3.8080244175059595`*^9}, {3.808024714986085*^9, 3.8080247536203003`*^9}, { 3.8080248760236254`*^9, 3.8080248798078136`*^9}, {3.8080251688543015`*^9, 3.8080251694363513`*^9}, {3.8080253234725013`*^9, 3.808025401641448*^9}, { 3.8080256335897083`*^9, 3.8080257012118573`*^9}, {3.8080258303867445`*^9, 3.8080258322876854`*^9}, {3.808025926612808*^9, 3.8080259272708406`*^9}, 3.8080284765294*^9, {3.8080290134033995`*^9, 3.808029015723693*^9}, { 3.8080462819956975`*^9, 3.808046326143379*^9}, {3.8080463622500887`*^9, 3.8080464494215565`*^9}, {3.8080464859419794`*^9, 3.8080465065092793`*^9}, {3.8080465425911245`*^9, 3.8080466715951395`*^9}, {3.8080467510200653`*^9, 3.808046785350086*^9}, { 3.808046817481633*^9, 3.808046916872596*^9}, {3.808048647801354*^9, 3.808048690642096*^9}, {3.8080489586961365`*^9, 3.80804897416216*^9}, { 3.8080490281121063`*^9, 3.808049049395793*^9}, 3.808452184588271*^9, 3.8089635147391834`*^9, {3.8089841328828225`*^9, 3.8089841519743586`*^9}, { 3.808984700934676*^9, 3.808984704020496*^9}, {3.8089847663699713`*^9, 3.8089848376136804`*^9}, {3.8089850370913124`*^9, 3.8089850380287156`*^9}, {3.8089852548830523`*^9, 3.808985259047535*^9}, { 3.8094112333981647`*^9, 3.809411279959066*^9}, {3.809411311186953*^9, 3.809411327031459*^9}, 3.809411442729566*^9, 3.8094114783490057`*^9, { 3.8094130613741493`*^9, 3.8094130823324313`*^9}, {3.8094131329124985`*^9, 3.809413136878616*^9}, {3.8094132173964767`*^9, 3.8094132936849327`*^9}, { 3.8130492229012623`*^9, 3.8130492505378075`*^9}}, ExpressionUUID -> "d91525d2-8993-4234-b24a-1e79611e56b2"] }, Open ]] }, WindowSize->{1536, 779}, WindowMargins->{{-8, Automatic}, {Automatic, -8}}, FrontEndVersion->"11.0 for Microsoft Windows (64-bit) (September 21, 2016)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 452, 7, 49, "Subsection"], Cell[1035, 31, 5712, 162, 119, "Text"], Cell[6750, 195, 31848, 715, 1399, "Input"] }, Open ]] } ] *)