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 3 | 2 | 2 | 3 | 2 | 1 | 1 | 4 | 3 | 0 |
TrialMatrix[n_,d_]:=Table[Sum[,{k,d}],{i,n},{j,n}]
2
(x[i,k]-x[j,k])
Apply[Plus,Flatten[TrialMatrix[16,2]-%706^2]^2];
Union[Cases[%,x[_,_],∞]];
Length[%]
32
%719
{x[1,1],x[1,2],x[2,1],x[2,2],x[3,1],x[3,2],x[4,1],x[4,2],x[5,1],x[5,2],x[6,1],x[6,2],x[7,1],x[7,2],x[8,1],x[8,2],x[9,1],x[9,2],x[10,1],x[10,2],x[11,1],x[11,2],x[12,1],x[12,2],x[13,1],x[13,2],x[14,1],x[14,2],x[15,1],x[15,2],x[16,1],x[16,2]}
FindMinimum[Evaluate[%718],##]&@@({#,Random[]}&/@%721)
FindMinimum::fmcv:Failed to converge to the requested accuracy or precision within 30 iterations.
{1811.02,{x[1,1]-1.27963,x[1,2]0.651349,x[2,1]-0.473601,x[2,2]-0.995022,x[3,1]2.19028,x[3,2]0.309157,x[4,1]1.38426,x[4,2]1.95553,x[5,1]-1.01995,x[5,2]1.40918,x[6,1]0.284232,x[6,2]-1.2547,x[7,1]1.9306,x[7,2]-0.448676,x[8,1]0.626424,x[8,2]2.21521,x[9,1]-1.27963,x[9,2]0.651349,x[10,1]-0.473601,x[10,2]-0.995022,x[11,1]2.19028,x[11,2]0.309157,x[12,1]1.38426,x[12,2]1.95553,x[13,1]-1.01995,x[13,2]1.40918,x[14,1]0.284232,x[14,2]-1.2547,x[15,1]1.9306,x[15,2]-0.448676,x[16,1]0.626423,x[16,2]2.21521}}
Partition[Last/@Last[%728],2]
{{-1.27963,0.651349},{-0.473601,-0.995022},{2.19028,0.309157},{1.38426,1.95553},{-1.01995,1.40918},{0.284232,-1.2547},{1.9306,-0.448676},{0.626424,2.21521},{-1.27963,0.651349},{-0.473601,-0.995022},{2.19028,0.309157},{1.38426,1.95553},{-1.01995,1.40918},{0.284232,-1.2547},{1.9306,-0.448676},{0.626423,2.21521}}
NodesToEdges[TwoD[4]]
{{1,2},{1,5},{1,13},{2,6},{2,14},{3,4},{3,7},{3,15},{4,8},{4,16},{5,8},{5,9},{6,7},{6,10},{7,11},{8,12},{9,10},{9,13},{10,14},{11,12},{11,15},{12,16},{13,16},{14,15}}
Map[%730[[#]]&,%729,{-1}]
{{{-1.27963,0.651349},{-0.473601,-0.995022}},{{-1.27963,0.651349},{-1.01995,1.40918}},{{-1.27963,0.651349},{-1.01995,1.40918}},{{-0.473601,-0.995022},{0.284232,-1.2547}},{{-0.473601,-0.995022},{0.284232,-1.2547}},{{2.19028,0.309157},{1.38426,1.95553}},{{2.19028,0.309157},{1.9306,-0.448676}},{{2.19028,0.309157},{1.9306,-0.448676}},{{1.38426,1.95553},{0.626424,2.21521}},{{1.38426,1.95553},{0.626423,2.21521}},{{-1.01995,1.40918},{0.626424,2.21521}},{{-1.01995,1.40918},{-1.27963,0.651349}},{{0.284232,-1.2547},{1.9306,-0.448676}},{{0.284232,-1.2547},{-0.473601,-0.995022}},{{1.9306,-0.448676},{2.19028,0.309157}},{{0.626424,2.21521},{1.38426,1.95553}},{{-1.27963,0.651349},{-0.473601,-0.995022}},{{-1.27963,0.651349},{-1.01995,1.40918}},{{-0.473601,-0.995022},{0.284232,-1.2547}},{{2.19028,0.309157},{1.38426,1.95553}},{{2.19028,0.309157},{1.9306,-0.448676}},{{1.38426,1.95553},{0.626423,2.21521}},{{-1.01995,1.40918},{0.626423,2.21521}},{{0.284232,-1.2547},{1.9306,-0.448676}}}
Show[Graphics[Line/@%,AspectRatio->Automatic]];
AddRim2D[Line/@Lines2D[2]];
Show[%];
ReverseEngineer[%]
{1{2,3,4},2{1,5,6},3{1,7,11},4{1,5,8},5{2,4,9},6{2,10,16},7{3,8,12},8{4,7,13},9{5,10,14},10{6,9,15},11{3,12,21},12{7,11,17},13{8,14,18},14{9,13,19},15{10,16,20},16{6,15,26},17{12,18,22},18{13,17,23},19{14,20,24},20{15,19,25},21{11,22,31},22{17,21,27},23{18,24,28},24{19,23,29},25{20,26,30},26{16,25,34},27{22,28,31},28{23,27,32},29{24,30,33},30{25,29,34},31{21,27,35},32{28,33,35},33{29,32,36},34{26,30,36},35{31,32,36},36{33,34,35}}
DistanceMatrix[%743];
%744
ListDensityPlot[%];
Apply[Plus,Flatten[TrialMatrix[36,2]-%744^2]^2];
Union[Cases[%,x[_,_],∞]];
Using different weighting