(* 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[ 7405, 196] NotebookOptionsPosition[ 6818, 178] NotebookOutlinePosition[ 7223, 194] CellTagsIndexPosition[ 7180, 191] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["\<\ Simplified silhouette with criterion for optimal LS partition\ \>", "Subsubsection", CellChangeTimes->{{3.73112424028771*^9, 3.7311242546173754`*^9}, { 3.8106047392458076`*^9, 3.8106047456549196`*^9}, {3.8131286886441045`*^9, 3.8131286920600576`*^9}, 3.8210125983161287`*^9, {3.8210127933056593`*^9, 3.8210128227915487`*^9}, 3.821012946405038*^9},ExpressionUUID->"e66d6e93-d6b2-4c5b-9154-\ 8959b5b959a5"], Cell[BoxData[ RowBox[{"(*", " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"Input", ":", " ", RowBox[{ RowBox[{ "partition", " ", "\[CapitalPi]", " ", "of", " ", "the", " ", "set", " ", "\[ScriptCapitalA]"}], " ", "\[Subset]", " ", SuperscriptBox["\[DoubleStruckCapitalR]", "n"]}]}], ";", "\[IndentingNewLine]", RowBox[{"Output", ":", " ", RowBox[{ "SSWC", " ", "index", " ", "of", " ", "the", " ", "partition", " ", "\[CapitalPi]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Submodules", ":", " ", RowBox[{"none", " ", "needed"}]}]}], " ", "\[IndentingNewLine]", "*)"}]], "Input", CellChangeTimes->{{3.7311239388490767`*^9, 3.7311241887665453`*^9}, { 3.731124262852821*^9, 3.7311242818390455`*^9}, {3.731124334688675*^9, 3.7311243931480875`*^9}, {3.731124464437002*^9, 3.7311245820590296`*^9}, { 3.731124626641944*^9, 3.7311246685996666`*^9}, 3.73112478187739*^9, 3.7311249716632557`*^9, 3.731125008229858*^9, {3.731131363164089*^9, 3.7311315307912507`*^9}, {3.8106047626816826`*^9, 3.810604763185858*^9}, { 3.810606445967278*^9, 3.810606530225013*^9}, {3.810606641466092*^9, 3.810606684833495*^9}, {3.810606749868683*^9, 3.810606752984932*^9}, { 3.8106068274532113`*^9, 3.810606866094061*^9}, {3.810606901083395*^9, 3.810607019637113*^9}, {3.810607054277118*^9, 3.8106071829172134`*^9}, { 3.8106072199097958`*^9, 3.8106072546405845`*^9}, 3.8106074697262*^9, { 3.8131282699269085`*^9, 3.813128270182798*^9}, {3.8131283217992973`*^9, 3.8131283433443713`*^9}, {3.8131285602764816`*^9, 3.813128631734671*^9}, { 3.813128716159551*^9, 3.8131287310664387`*^9}, {3.813128829720832*^9, 3.8131288437367177`*^9}, {3.8131288968861256`*^9, 3.8131288976456766`*^9}, {3.8208206004327154`*^9, 3.820820602339464*^9}, { 3.8208232348027654`*^9, 3.820823235970901*^9}, {3.8210126257677174`*^9, 3.8210126431522183`*^9}, {3.8210126931585455`*^9, 3.8210127495586214`*^9}, {3.8210128351185436`*^9, 3.821012855257584*^9}, { 3.821013023738287*^9, 3.821013027867689*^9}},ExpressionUUID->"a16ffa28-7742-4592-bcc2-\ c1a697822085"], Cell[BoxData[{ RowBox[{"Clear", "[", "SSWC", "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"SSWC", "[", "PI_", "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"k", "=", RowBox[{"Length", "[", "PI", "]"}]}], ",", "a", ",", "b", ",", "dd", ",", "w"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"set", "=", RowBox[{"Flatten", "[", RowBox[{"PI", ",", "1"}], "]"}]}], ";", RowBox[{"m", "=", RowBox[{"Length", "[", "set", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"a", "=", RowBox[{"b", "=", RowBox[{"Table", "[", RowBox[{"0", ",", RowBox[{"{", RowBox[{"i", ",", "m"}], "}"}]}], "]"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"w", "=", RowBox[{"set", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], ";", RowBox[{"A", "=", RowBox[{"set", "[", RowBox[{"[", RowBox[{"All", ",", "2"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"z", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Mean", "[", RowBox[{"WeightedData", "[", RowBox[{ RowBox[{"PI", "[", RowBox[{"[", RowBox[{"j", ",", "All", ",", "2"}], "]"}], "]"}], ",", RowBox[{"PI", "[", RowBox[{"[", RowBox[{"j", ",", "All", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", RowBox[{"Length", "[", "PI", "]"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"dd", "=", RowBox[{"Sort", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"w", "[", RowBox[{"[", "i", "]"}], "]"}], " ", RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"z", "[", RowBox[{"[", "j", "]"}], "]"}]}], "]"}], "^", "2"}]}], ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"a", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"dd", "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", RowBox[{ RowBox[{"b", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"dd", "[", RowBox[{"[", "2", "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"i", ",", "m"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"Sum", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"b", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"a", "[", RowBox[{"[", "i", "]"}], "]"}]}], ")"}], "/", RowBox[{"Max", "[", RowBox[{"{", RowBox[{ RowBox[{"a", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"b", "[", RowBox[{"[", "i", "]"}], "]"}]}], "}"}], "]"}]}], ",", RowBox[{"{", RowBox[{"i", ",", "m"}], "}"}]}], "]"}], "/", "m"}]}]}], "\[IndentingNewLine]", "]"}]}]}], "Input", CellChangeTimes->{{3.8288751402220716`*^9, 3.828875150272829*^9}},ExpressionUUID->"57bed60b-22ff-4d1d-b834-\ f5bb1fcaa491"] }, Open ]] }, WindowSize->{754, 463}, WindowMargins->{{-1912, Automatic}, {Automatic, 10}}, TaggingRules->{"SlideshowSettings" -> {"Toolbar" -> True}}, FrontEndVersion->"12.0 for Microsoft Windows (64-bit) (April 8, 2019)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 430, 8, 44, "Subsubsection",ExpressionUUID->"e66d6e93-d6b2-4c5b-9154-8959b5b959a5"], Cell[1013, 32, 2141, 38, 105, "Input",ExpressionUUID->"a16ffa28-7742-4592-bcc2-c1a697822085"], Cell[3157, 72, 3645, 103, 238, "Input",ExpressionUUID->"57bed60b-22ff-4d1d-b834-f5bb1fcaa491"] }, Open ]] } ] *)