Merge remote-tracking branch 'refs/remotes/origin/main'
This commit is contained in:
commit
e6d0ece5bb
|
@ -1,100 +1,100 @@
|
|||
let dist[1][1] := 7;
|
||||
let dist[1][2] := 13;
|
||||
let dist[1][3] := 12;
|
||||
let dist[1][4] := 10;
|
||||
let dist[1][5] := 13;
|
||||
let dist[1][6] := 13;
|
||||
let dist[1][7] := 18;
|
||||
let dist[1][8] := 3;
|
||||
let dist[1][9] := 3;
|
||||
let dist[1][10] := 12;
|
||||
let dist[2][1] := 9;
|
||||
let dist[2][2] := 14;
|
||||
let dist[2][3] := 20;
|
||||
let dist[2][4] := 7;
|
||||
let dist[2][5] := 18;
|
||||
let dist[2][6] := 11;
|
||||
let dist[2][7] := 2;
|
||||
let dist[2][8] := 16;
|
||||
let dist[2][9] := 2;
|
||||
let dist[2][10] := 4;
|
||||
let dist[3][1] := 11;
|
||||
let dist[3][2] := 14;
|
||||
let dist[3][3] := 19;
|
||||
let dist[3][4] := 4;
|
||||
let dist[3][5] := 13;
|
||||
let dist[3][6] := 7;
|
||||
let dist[3][7] := 6;
|
||||
let dist[3][8] := 17;
|
||||
let dist[3][9] := 10;
|
||||
let dist[3][10] := 13;
|
||||
let dist[4][1] := 18;
|
||||
let dist[4][2] := 12;
|
||||
let dist[4][3] := 15;
|
||||
let dist[4][4] := 11;
|
||||
let dist[4][5] := 7;
|
||||
let dist[4][6] := 19;
|
||||
let dist[4][7] := 20;
|
||||
let dist[4][8] := 4;
|
||||
let dist[4][9] := 12;
|
||||
let dist[4][10] := 14;
|
||||
let dist[5][1] := 6;
|
||||
let dist[5][2] := 15;
|
||||
let dist[5][3] := 5;
|
||||
let dist[5][4] := 1;
|
||||
let dist[5][5] := 20;
|
||||
let dist[5][6] := 19;
|
||||
let dist[5][7] := 2;
|
||||
let dist[5][8] := 20;
|
||||
let dist[5][9] := 20;
|
||||
let dist[5][10] := 14;
|
||||
let dist[6][1] := 7;
|
||||
let dist[6][2] := 12;
|
||||
let dist[6][3] := 11;
|
||||
let dist[6][4] := 8;
|
||||
let dist[6][5] := 2;
|
||||
let dist[6][6] := 18;
|
||||
let dist[6][7] := 20;
|
||||
let dist[6][8] := 9;
|
||||
let dist[6][9] := 3;
|
||||
let dist[6][10] := 7;
|
||||
let dist[7][1] := 7;
|
||||
let dist[7][2] := 14;
|
||||
let dist[7][3] := 15;
|
||||
let dist[7][4] := 7;
|
||||
let dist[7][5] := 18;
|
||||
let dist[7][6] := 16;
|
||||
let dist[7][7] := 6;
|
||||
let dist[7][8] := 8;
|
||||
let dist[7][9] := 3;
|
||||
let dist[7][10] := 14;
|
||||
let dist[8][1] := 12;
|
||||
let dist[8][2] := 8;
|
||||
let dist[8][3] := 9;
|
||||
let dist[8][4] := 2;
|
||||
let dist[8][5] := 4;
|
||||
let dist[8][6] := 16;
|
||||
let dist[8][7] := 8;
|
||||
let dist[8][8] := 2;
|
||||
let dist[8][9] := 12;
|
||||
let dist[8][10] := 9;
|
||||
let dist[9][1] := 15;
|
||||
let dist[9][2] := 7;
|
||||
let dist[9][3] := 16;
|
||||
let dist[9][4] := 2;
|
||||
let dist[9][5] := 16;
|
||||
let dist[9][6] := 14;
|
||||
let dist[9][7] := 13;
|
||||
let dist[9][8] := 4;
|
||||
let dist[9][9] := 1;
|
||||
let dist[9][10] := 19;
|
||||
let dist[10][1] := 11;
|
||||
let dist[10][2] := 11;
|
||||
let dist[10][3] := 16;
|
||||
let dist[10][4] := 14;
|
||||
let dist[10][5] := 20;
|
||||
let dist[10][6] := 11;
|
||||
let dist[10][7] := 3;
|
||||
let dist[10][8] := 15;
|
||||
let dist[10][9] := 17;
|
||||
let dist[10][10] := 13;
|
||||
let dist[1, 1] := 7;
|
||||
let dist[1, 2] := 13;
|
||||
let dist[1, 3] := 12;
|
||||
let dist[1, 4] := 10;
|
||||
let dist[1, 5] := 13;
|
||||
let dist[1, 6] := 13;
|
||||
let dist[1, 7] := 18;
|
||||
let dist[1, 8] := 3;
|
||||
let dist[1, 9] := 3;
|
||||
let dist[1, 10] := 12;
|
||||
let dist[2, 1] := 9;
|
||||
let dist[2, 2] := 14;
|
||||
let dist[2, 3] := 20;
|
||||
let dist[2, 4] := 7;
|
||||
let dist[2, 5] := 18;
|
||||
let dist[2, 6] := 11;
|
||||
let dist[2, 7] := 2;
|
||||
let dist[2, 8] := 16;
|
||||
let dist[2, 9] := 2;
|
||||
let dist[2, 10] := 4;
|
||||
let dist[3, 1] := 11;
|
||||
let dist[3, 2] := 14;
|
||||
let dist[3, 3] := 19;
|
||||
let dist[3, 4] := 4;
|
||||
let dist[3, 5] := 13;
|
||||
let dist[3, 6] := 7;
|
||||
let dist[3, 7] := 6;
|
||||
let dist[3, 8] := 17;
|
||||
let dist[3, 9] := 10;
|
||||
let dist[3, 10] := 13;
|
||||
let dist[4, 1] := 18;
|
||||
let dist[4, 2] := 12;
|
||||
let dist[4, 3] := 15;
|
||||
let dist[4, 4] := 11;
|
||||
let dist[4, 5] := 7;
|
||||
let dist[4, 6] := 19;
|
||||
let dist[4, 7] := 20;
|
||||
let dist[4, 8] := 4;
|
||||
let dist[4, 9] := 12;
|
||||
let dist[4, 10] := 14;
|
||||
let dist[5, 1] := 6;
|
||||
let dist[5, 2] := 15;
|
||||
let dist[5, 3] := 5;
|
||||
let dist[5, 4] := 1;
|
||||
let dist[5, 5] := 20;
|
||||
let dist[5, 6] := 19;
|
||||
let dist[5, 7] := 2;
|
||||
let dist[5, 8] := 20;
|
||||
let dist[5, 9] := 20;
|
||||
let dist[5, 10] := 14;
|
||||
let dist[6, 1] := 7;
|
||||
let dist[6, 2] := 12;
|
||||
let dist[6, 3] := 11;
|
||||
let dist[6, 4] := 8;
|
||||
let dist[6, 5] := 2;
|
||||
let dist[6, 6] := 18;
|
||||
let dist[6, 7] := 20;
|
||||
let dist[6, 8] := 9;
|
||||
let dist[6, 9] := 3;
|
||||
let dist[6, 10] := 7;
|
||||
let dist[7, 1] := 7;
|
||||
let dist[7, 2] := 14;
|
||||
let dist[7, 3] := 15;
|
||||
let dist[7, 4] := 7;
|
||||
let dist[7, 5] := 18;
|
||||
let dist[7, 6] := 16;
|
||||
let dist[7, 7] := 6;
|
||||
let dist[7, 8] := 8;
|
||||
let dist[7, 9] := 3;
|
||||
let dist[7, 10] := 14;
|
||||
let dist[8, 1] := 12;
|
||||
let dist[8, 2] := 8;
|
||||
let dist[8, 3] := 9;
|
||||
let dist[8, 4] := 2;
|
||||
let dist[8, 5] := 4;
|
||||
let dist[8, 6] := 16;
|
||||
let dist[8, 7] := 8;
|
||||
let dist[8, 8] := 2;
|
||||
let dist[8, 9] := 12;
|
||||
let dist[8, 10] := 9;
|
||||
let dist[9, 1] := 15;
|
||||
let dist[9, 2] := 7;
|
||||
let dist[9, 3] := 16;
|
||||
let dist[9, 4] := 2;
|
||||
let dist[9, 5] := 16;
|
||||
let dist[9, 6] := 14;
|
||||
let dist[9, 7] := 13;
|
||||
let dist[9, 8] := 4;
|
||||
let dist[9, 9] := 1;
|
||||
let dist[9, 10] := 19;
|
||||
let dist[10, 1] := 11;
|
||||
let dist[10, 2] := 11;
|
||||
let dist[10, 3] := 16;
|
||||
let dist[10, 4] := 14;
|
||||
let dist[10, 5] := 20;
|
||||
let dist[10, 6] := 11;
|
||||
let dist[10, 7] := 3;
|
||||
let dist[10, 8] := 15;
|
||||
let dist[10, 9] := 17;
|
||||
let dist[10, 10] := 13;
|
||||
|
|
|
@ -1,225 +1,225 @@
|
|||
let dist[1][1] := 11;
|
||||
let dist[1][2] := 4;
|
||||
let dist[1][3] := 4;
|
||||
let dist[1][4] := 14;
|
||||
let dist[1][5] := 12;
|
||||
let dist[1][6] := 20;
|
||||
let dist[1][7] := 1;
|
||||
let dist[1][8] := 1;
|
||||
let dist[1][9] := 14;
|
||||
let dist[1][10] := 12;
|
||||
let dist[1][11] := 15;
|
||||
let dist[1][12] := 15;
|
||||
let dist[1][13] := 18;
|
||||
let dist[1][14] := 11;
|
||||
let dist[1][15] := 19;
|
||||
let dist[2][1] := 5;
|
||||
let dist[2][2] := 13;
|
||||
let dist[2][3] := 3;
|
||||
let dist[2][4] := 6;
|
||||
let dist[2][5] := 15;
|
||||
let dist[2][6] := 6;
|
||||
let dist[2][7] := 7;
|
||||
let dist[2][8] := 5;
|
||||
let dist[2][9] := 3;
|
||||
let dist[2][10] := 19;
|
||||
let dist[2][11] := 11;
|
||||
let dist[2][12] := 8;
|
||||
let dist[2][13] := 13;
|
||||
let dist[2][14] := 6;
|
||||
let dist[2][15] := 12;
|
||||
let dist[3][1] := 3;
|
||||
let dist[3][2] := 4;
|
||||
let dist[3][3] := 10;
|
||||
let dist[3][4] := 2;
|
||||
let dist[3][5] := 3;
|
||||
let dist[3][6] := 1;
|
||||
let dist[3][7] := 1;
|
||||
let dist[3][8] := 2;
|
||||
let dist[3][9] := 11;
|
||||
let dist[3][10] := 2;
|
||||
let dist[3][11] := 9;
|
||||
let dist[3][12] := 10;
|
||||
let dist[3][13] := 14;
|
||||
let dist[3][14] := 20;
|
||||
let dist[3][15] := 19;
|
||||
let dist[4][1] := 17;
|
||||
let dist[4][2] := 3;
|
||||
let dist[4][3] := 17;
|
||||
let dist[4][4] := 4;
|
||||
let dist[4][5] := 13;
|
||||
let dist[4][6] := 19;
|
||||
let dist[4][7] := 20;
|
||||
let dist[4][8] := 12;
|
||||
let dist[4][9] := 18;
|
||||
let dist[4][10] := 9;
|
||||
let dist[4][11] := 11;
|
||||
let dist[4][12] := 20;
|
||||
let dist[4][13] := 16;
|
||||
let dist[4][14] := 18;
|
||||
let dist[4][15] := 19;
|
||||
let dist[5][1] := 6;
|
||||
let dist[5][2] := 5;
|
||||
let dist[5][3] := 2;
|
||||
let dist[5][4] := 14;
|
||||
let dist[5][5] := 20;
|
||||
let dist[5][6] := 8;
|
||||
let dist[5][7] := 15;
|
||||
let dist[5][8] := 6;
|
||||
let dist[5][9] := 2;
|
||||
let dist[5][10] := 13;
|
||||
let dist[5][11] := 12;
|
||||
let dist[5][12] := 7;
|
||||
let dist[5][13] := 4;
|
||||
let dist[5][14] := 9;
|
||||
let dist[5][15] := 6;
|
||||
let dist[6][1] := 6;
|
||||
let dist[6][2] := 6;
|
||||
let dist[6][3] := 14;
|
||||
let dist[6][4] := 6;
|
||||
let dist[6][5] := 9;
|
||||
let dist[6][6] := 20;
|
||||
let dist[6][7] := 14;
|
||||
let dist[6][8] := 13;
|
||||
let dist[6][9] := 19;
|
||||
let dist[6][10] := 12;
|
||||
let dist[6][11] := 1;
|
||||
let dist[6][12] := 1;
|
||||
let dist[6][13] := 1;
|
||||
let dist[6][14] := 17;
|
||||
let dist[6][15] := 11;
|
||||
let dist[7][1] := 15;
|
||||
let dist[7][2] := 5;
|
||||
let dist[7][3] := 4;
|
||||
let dist[7][4] := 13;
|
||||
let dist[7][5] := 16;
|
||||
let dist[7][6] := 1;
|
||||
let dist[7][7] := 6;
|
||||
let dist[7][8] := 12;
|
||||
let dist[7][9] := 13;
|
||||
let dist[7][10] := 5;
|
||||
let dist[7][11] := 1;
|
||||
let dist[7][12] := 15;
|
||||
let dist[7][13] := 18;
|
||||
let dist[7][14] := 19;
|
||||
let dist[7][15] := 4;
|
||||
let dist[8][1] := 6;
|
||||
let dist[8][2] := 13;
|
||||
let dist[8][3] := 2;
|
||||
let dist[8][4] := 5;
|
||||
let dist[8][5] := 10;
|
||||
let dist[8][6] := 6;
|
||||
let dist[8][7] := 18;
|
||||
let dist[8][8] := 10;
|
||||
let dist[8][9] := 3;
|
||||
let dist[8][10] := 12;
|
||||
let dist[8][11] := 15;
|
||||
let dist[8][12] := 7;
|
||||
let dist[8][13] := 17;
|
||||
let dist[8][14] := 19;
|
||||
let dist[8][15] := 1;
|
||||
let dist[9][1] := 15;
|
||||
let dist[9][2] := 11;
|
||||
let dist[9][3] := 12;
|
||||
let dist[9][4] := 18;
|
||||
let dist[9][5] := 9;
|
||||
let dist[9][6] := 20;
|
||||
let dist[9][7] := 19;
|
||||
let dist[9][8] := 9;
|
||||
let dist[9][9] := 8;
|
||||
let dist[9][10] := 4;
|
||||
let dist[9][11] := 5;
|
||||
let dist[9][12] := 19;
|
||||
let dist[9][13] := 8;
|
||||
let dist[9][14] := 5;
|
||||
let dist[9][15] := 14;
|
||||
let dist[10][1] := 1;
|
||||
let dist[10][2] := 4;
|
||||
let dist[10][3] := 19;
|
||||
let dist[10][4] := 7;
|
||||
let dist[10][5] := 20;
|
||||
let dist[10][6] := 11;
|
||||
let dist[10][7] := 5;
|
||||
let dist[10][8] := 11;
|
||||
let dist[10][9] := 9;
|
||||
let dist[10][10] := 19;
|
||||
let dist[10][11] := 15;
|
||||
let dist[10][12] := 8;
|
||||
let dist[10][13] := 12;
|
||||
let dist[10][14] := 4;
|
||||
let dist[10][15] := 19;
|
||||
let dist[11][1] := 20;
|
||||
let dist[11][2] := 12;
|
||||
let dist[11][3] := 5;
|
||||
let dist[11][4] := 18;
|
||||
let dist[11][5] := 10;
|
||||
let dist[11][6] := 19;
|
||||
let dist[11][7] := 1;
|
||||
let dist[11][8] := 3;
|
||||
let dist[11][9] := 8;
|
||||
let dist[11][10] := 18;
|
||||
let dist[11][11] := 13;
|
||||
let dist[11][12] := 20;
|
||||
let dist[11][13] := 2;
|
||||
let dist[11][14] := 13;
|
||||
let dist[11][15] := 13;
|
||||
let dist[12][1] := 5;
|
||||
let dist[12][2] := 12;
|
||||
let dist[12][3] := 9;
|
||||
let dist[12][4] := 2;
|
||||
let dist[12][5] := 10;
|
||||
let dist[12][6] := 3;
|
||||
let dist[12][7] := 10;
|
||||
let dist[12][8] := 18;
|
||||
let dist[12][9] := 10;
|
||||
let dist[12][10] := 18;
|
||||
let dist[12][11] := 1;
|
||||
let dist[12][12] := 16;
|
||||
let dist[12][13] := 6;
|
||||
let dist[12][14] := 8;
|
||||
let dist[12][15] := 20;
|
||||
let dist[13][1] := 1;
|
||||
let dist[13][2] := 20;
|
||||
let dist[13][3] := 4;
|
||||
let dist[13][4] := 12;
|
||||
let dist[13][5] := 4;
|
||||
let dist[13][6] := 19;
|
||||
let dist[13][7] := 17;
|
||||
let dist[13][8] := 12;
|
||||
let dist[13][9] := 19;
|
||||
let dist[13][10] := 13;
|
||||
let dist[13][11] := 2;
|
||||
let dist[13][12] := 5;
|
||||
let dist[13][13] := 2;
|
||||
let dist[13][14] := 5;
|
||||
let dist[13][15] := 5;
|
||||
let dist[14][1] := 2;
|
||||
let dist[14][2] := 1;
|
||||
let dist[14][3] := 16;
|
||||
let dist[14][4] := 2;
|
||||
let dist[14][5] := 15;
|
||||
let dist[14][6] := 20;
|
||||
let dist[14][7] := 12;
|
||||
let dist[14][8] := 6;
|
||||
let dist[14][9] := 5;
|
||||
let dist[14][10] := 9;
|
||||
let dist[14][11] := 4;
|
||||
let dist[14][12] := 19;
|
||||
let dist[14][13] := 9;
|
||||
let dist[14][14] := 1;
|
||||
let dist[14][15] := 13;
|
||||
let dist[15][1] := 12;
|
||||
let dist[15][2] := 9;
|
||||
let dist[15][3] := 20;
|
||||
let dist[15][4] := 9;
|
||||
let dist[15][5] := 2;
|
||||
let dist[15][6] := 6;
|
||||
let dist[15][7] := 17;
|
||||
let dist[15][8] := 12;
|
||||
let dist[15][9] := 11;
|
||||
let dist[15][10] := 19;
|
||||
let dist[15][11] := 20;
|
||||
let dist[15][12] := 6;
|
||||
let dist[15][13] := 3;
|
||||
let dist[15][14] := 12;
|
||||
let dist[15][15] := 18;
|
||||
let dist[1, 1] := 11;
|
||||
let dist[1, 2] := 4;
|
||||
let dist[1, 3] := 4;
|
||||
let dist[1, 4] := 14;
|
||||
let dist[1, 5] := 12;
|
||||
let dist[1, 6] := 20;
|
||||
let dist[1, 7] := 1;
|
||||
let dist[1, 8] := 1;
|
||||
let dist[1, 9] := 14;
|
||||
let dist[1, 10] := 12;
|
||||
let dist[1, 11] := 15;
|
||||
let dist[1, 12] := 15;
|
||||
let dist[1, 13] := 18;
|
||||
let dist[1, 14] := 11;
|
||||
let dist[1, 15] := 19;
|
||||
let dist[2, 1] := 5;
|
||||
let dist[2, 2] := 13;
|
||||
let dist[2, 3] := 3;
|
||||
let dist[2, 4] := 6;
|
||||
let dist[2, 5] := 15;
|
||||
let dist[2, 6] := 6;
|
||||
let dist[2, 7] := 7;
|
||||
let dist[2, 8] := 5;
|
||||
let dist[2, 9] := 3;
|
||||
let dist[2, 10] := 19;
|
||||
let dist[2, 11] := 11;
|
||||
let dist[2, 12] := 8;
|
||||
let dist[2, 13] := 13;
|
||||
let dist[2, 14] := 6;
|
||||
let dist[2, 15] := 12;
|
||||
let dist[3, 1] := 3;
|
||||
let dist[3, 2] := 4;
|
||||
let dist[3, 3] := 10;
|
||||
let dist[3, 4] := 2;
|
||||
let dist[3, 5] := 3;
|
||||
let dist[3, 6] := 1;
|
||||
let dist[3, 7] := 1;
|
||||
let dist[3, 8] := 2;
|
||||
let dist[3, 9] := 11;
|
||||
let dist[3, 10] := 2;
|
||||
let dist[3, 11] := 9;
|
||||
let dist[3, 12] := 10;
|
||||
let dist[3, 13] := 14;
|
||||
let dist[3, 14] := 20;
|
||||
let dist[3, 15] := 19;
|
||||
let dist[4, 1] := 17;
|
||||
let dist[4, 2] := 3;
|
||||
let dist[4, 3] := 17;
|
||||
let dist[4, 4] := 4;
|
||||
let dist[4, 5] := 13;
|
||||
let dist[4, 6] := 19;
|
||||
let dist[4, 7] := 20;
|
||||
let dist[4, 8] := 12;
|
||||
let dist[4, 9] := 18;
|
||||
let dist[4, 10] := 9;
|
||||
let dist[4, 11] := 11;
|
||||
let dist[4, 12] := 20;
|
||||
let dist[4, 13] := 16;
|
||||
let dist[4, 14] := 18;
|
||||
let dist[4, 15] := 19;
|
||||
let dist[5, 1] := 6;
|
||||
let dist[5, 2] := 5;
|
||||
let dist[5, 3] := 2;
|
||||
let dist[5, 4] := 14;
|
||||
let dist[5, 5] := 20;
|
||||
let dist[5, 6] := 8;
|
||||
let dist[5, 7] := 15;
|
||||
let dist[5, 8] := 6;
|
||||
let dist[5, 9] := 2;
|
||||
let dist[5, 10] := 13;
|
||||
let dist[5, 11] := 12;
|
||||
let dist[5, 12] := 7;
|
||||
let dist[5, 13] := 4;
|
||||
let dist[5, 14] := 9;
|
||||
let dist[5, 15] := 6;
|
||||
let dist[6, 1] := 6;
|
||||
let dist[6, 2] := 6;
|
||||
let dist[6, 3] := 14;
|
||||
let dist[6, 4] := 6;
|
||||
let dist[6, 5] := 9;
|
||||
let dist[6, 6] := 20;
|
||||
let dist[6, 7] := 14;
|
||||
let dist[6, 8] := 13;
|
||||
let dist[6, 9] := 19;
|
||||
let dist[6, 10] := 12;
|
||||
let dist[6, 11] := 1;
|
||||
let dist[6, 12] := 1;
|
||||
let dist[6, 13] := 1;
|
||||
let dist[6, 14] := 17;
|
||||
let dist[6, 15] := 11;
|
||||
let dist[7, 1] := 15;
|
||||
let dist[7, 2] := 5;
|
||||
let dist[7, 3] := 4;
|
||||
let dist[7, 4] := 13;
|
||||
let dist[7, 5] := 16;
|
||||
let dist[7, 6] := 1;
|
||||
let dist[7, 7] := 6;
|
||||
let dist[7, 8] := 12;
|
||||
let dist[7, 9] := 13;
|
||||
let dist[7, 10] := 5;
|
||||
let dist[7, 11] := 1;
|
||||
let dist[7, 12] := 15;
|
||||
let dist[7, 13] := 18;
|
||||
let dist[7, 14] := 19;
|
||||
let dist[7, 15] := 4;
|
||||
let dist[8, 1] := 6;
|
||||
let dist[8, 2] := 13;
|
||||
let dist[8, 3] := 2;
|
||||
let dist[8, 4] := 5;
|
||||
let dist[8, 5] := 10;
|
||||
let dist[8, 6] := 6;
|
||||
let dist[8, 7] := 18;
|
||||
let dist[8, 8] := 10;
|
||||
let dist[8, 9] := 3;
|
||||
let dist[8, 10] := 12;
|
||||
let dist[8, 11] := 15;
|
||||
let dist[8, 12] := 7;
|
||||
let dist[8, 13] := 17;
|
||||
let dist[8, 14] := 19;
|
||||
let dist[8, 15] := 1;
|
||||
let dist[9, 1] := 15;
|
||||
let dist[9, 2] := 11;
|
||||
let dist[9, 3] := 12;
|
||||
let dist[9, 4] := 18;
|
||||
let dist[9, 5] := 9;
|
||||
let dist[9, 6] := 20;
|
||||
let dist[9, 7] := 19;
|
||||
let dist[9, 8] := 9;
|
||||
let dist[9, 9] := 8;
|
||||
let dist[9, 10] := 4;
|
||||
let dist[9, 11] := 5;
|
||||
let dist[9, 12] := 19;
|
||||
let dist[9, 13] := 8;
|
||||
let dist[9, 14] := 5;
|
||||
let dist[9, 15] := 14;
|
||||
let dist[10, 1] := 1;
|
||||
let dist[10, 2] := 4;
|
||||
let dist[10, 3] := 19;
|
||||
let dist[10, 4] := 7;
|
||||
let dist[10, 5] := 20;
|
||||
let dist[10, 6] := 11;
|
||||
let dist[10, 7] := 5;
|
||||
let dist[10, 8] := 11;
|
||||
let dist[10, 9] := 9;
|
||||
let dist[10, 10] := 19;
|
||||
let dist[10, 11] := 15;
|
||||
let dist[10, 12] := 8;
|
||||
let dist[10, 13] := 12;
|
||||
let dist[10, 14] := 4;
|
||||
let dist[10, 15] := 19;
|
||||
let dist[11, 1] := 20;
|
||||
let dist[11, 2] := 12;
|
||||
let dist[11, 3] := 5;
|
||||
let dist[11, 4] := 18;
|
||||
let dist[11, 5] := 10;
|
||||
let dist[11, 6] := 19;
|
||||
let dist[11, 7] := 1;
|
||||
let dist[11, 8] := 3;
|
||||
let dist[11, 9] := 8;
|
||||
let dist[11, 10] := 18;
|
||||
let dist[11, 11] := 13;
|
||||
let dist[11, 12] := 20;
|
||||
let dist[11, 13] := 2;
|
||||
let dist[11, 14] := 13;
|
||||
let dist[11, 15] := 13;
|
||||
let dist[12, 1] := 5;
|
||||
let dist[12, 2] := 12;
|
||||
let dist[12, 3] := 9;
|
||||
let dist[12, 4] := 2;
|
||||
let dist[12, 5] := 10;
|
||||
let dist[12, 6] := 3;
|
||||
let dist[12, 7] := 10;
|
||||
let dist[12, 8] := 18;
|
||||
let dist[12, 9] := 10;
|
||||
let dist[12, 10] := 18;
|
||||
let dist[12, 11] := 1;
|
||||
let dist[12, 12] := 16;
|
||||
let dist[12, 13] := 6;
|
||||
let dist[12, 14] := 8;
|
||||
let dist[12, 15] := 20;
|
||||
let dist[13, 1] := 1;
|
||||
let dist[13, 2] := 20;
|
||||
let dist[13, 3] := 4;
|
||||
let dist[13, 4] := 12;
|
||||
let dist[13, 5] := 4;
|
||||
let dist[13, 6] := 19;
|
||||
let dist[13, 7] := 17;
|
||||
let dist[13, 8] := 12;
|
||||
let dist[13, 9] := 19;
|
||||
let dist[13, 10] := 13;
|
||||
let dist[13, 11] := 2;
|
||||
let dist[13, 12] := 5;
|
||||
let dist[13, 13] := 2;
|
||||
let dist[13, 14] := 5;
|
||||
let dist[13, 15] := 5;
|
||||
let dist[14, 1] := 2;
|
||||
let dist[14, 2] := 1;
|
||||
let dist[14, 3] := 16;
|
||||
let dist[14, 4] := 2;
|
||||
let dist[14, 5] := 15;
|
||||
let dist[14, 6] := 20;
|
||||
let dist[14, 7] := 12;
|
||||
let dist[14, 8] := 6;
|
||||
let dist[14, 9] := 5;
|
||||
let dist[14, 10] := 9;
|
||||
let dist[14, 11] := 4;
|
||||
let dist[14, 12] := 19;
|
||||
let dist[14, 13] := 9;
|
||||
let dist[14, 14] := 1;
|
||||
let dist[14, 15] := 13;
|
||||
let dist[15, 1] := 12;
|
||||
let dist[15, 2] := 9;
|
||||
let dist[15, 3] := 20;
|
||||
let dist[15, 4] := 9;
|
||||
let dist[15, 5] := 2;
|
||||
let dist[15, 6] := 6;
|
||||
let dist[15, 7] := 17;
|
||||
let dist[15, 8] := 12;
|
||||
let dist[15, 9] := 11;
|
||||
let dist[15, 10] := 19;
|
||||
let dist[15, 11] := 20;
|
||||
let dist[15, 12] := 6;
|
||||
let dist[15, 13] := 3;
|
||||
let dist[15, 14] := 12;
|
||||
let dist[15, 15] := 18;
|
||||
|
|
|
@ -1,400 +1,400 @@
|
|||
let dist[1][1] := 8;
|
||||
let dist[1][2] := 8;
|
||||
let dist[1][3] := 15;
|
||||
let dist[1][4] := 7;
|
||||
let dist[1][5] := 11;
|
||||
let dist[1][6] := 17;
|
||||
let dist[1][7] := 8;
|
||||
let dist[1][8] := 3;
|
||||
let dist[1][9] := 4;
|
||||
let dist[1][10] := 11;
|
||||
let dist[1][11] := 9;
|
||||
let dist[1][12] := 6;
|
||||
let dist[1][13] := 2;
|
||||
let dist[1][14] := 7;
|
||||
let dist[1][15] := 15;
|
||||
let dist[1][16] := 6;
|
||||
let dist[1][17] := 16;
|
||||
let dist[1][18] := 5;
|
||||
let dist[1][19] := 9;
|
||||
let dist[1][20] := 14;
|
||||
let dist[2][1] := 16;
|
||||
let dist[2][2] := 17;
|
||||
let dist[2][3] := 13;
|
||||
let dist[2][4] := 16;
|
||||
let dist[2][5] := 15;
|
||||
let dist[2][6] := 17;
|
||||
let dist[2][7] := 12;
|
||||
let dist[2][8] := 11;
|
||||
let dist[2][9] := 7;
|
||||
let dist[2][10] := 8;
|
||||
let dist[2][11] := 13;
|
||||
let dist[2][12] := 3;
|
||||
let dist[2][13] := 7;
|
||||
let dist[2][14] := 15;
|
||||
let dist[2][15] := 9;
|
||||
let dist[2][16] := 8;
|
||||
let dist[2][17] := 16;
|
||||
let dist[2][18] := 18;
|
||||
let dist[2][19] := 7;
|
||||
let dist[2][20] := 5;
|
||||
let dist[3][1] := 16;
|
||||
let dist[3][2] := 4;
|
||||
let dist[3][3] := 1;
|
||||
let dist[3][4] := 9;
|
||||
let dist[3][5] := 17;
|
||||
let dist[3][6] := 11;
|
||||
let dist[3][7] := 18;
|
||||
let dist[3][8] := 2;
|
||||
let dist[3][9] := 16;
|
||||
let dist[3][10] := 13;
|
||||
let dist[3][11] := 6;
|
||||
let dist[3][12] := 5;
|
||||
let dist[3][13] := 2;
|
||||
let dist[3][14] := 7;
|
||||
let dist[3][15] := 18;
|
||||
let dist[3][16] := 16;
|
||||
let dist[3][17] := 19;
|
||||
let dist[3][18] := 14;
|
||||
let dist[3][19] := 14;
|
||||
let dist[3][20] := 9;
|
||||
let dist[4][1] := 9;
|
||||
let dist[4][2] := 9;
|
||||
let dist[4][3] := 7;
|
||||
let dist[4][4] := 12;
|
||||
let dist[4][5] := 16;
|
||||
let dist[4][6] := 12;
|
||||
let dist[4][7] := 3;
|
||||
let dist[4][8] := 5;
|
||||
let dist[4][9] := 16;
|
||||
let dist[4][10] := 18;
|
||||
let dist[4][11] := 10;
|
||||
let dist[4][12] := 7;
|
||||
let dist[4][13] := 6;
|
||||
let dist[4][14] := 12;
|
||||
let dist[4][15] := 4;
|
||||
let dist[4][16] := 5;
|
||||
let dist[4][17] := 14;
|
||||
let dist[4][18] := 11;
|
||||
let dist[4][19] := 5;
|
||||
let dist[4][20] := 5;
|
||||
let dist[5][1] := 5;
|
||||
let dist[5][2] := 2;
|
||||
let dist[5][3] := 16;
|
||||
let dist[5][4] := 18;
|
||||
let dist[5][5] := 15;
|
||||
let dist[5][6] := 15;
|
||||
let dist[5][7] := 8;
|
||||
let dist[5][8] := 10;
|
||||
let dist[5][9] := 15;
|
||||
let dist[5][10] := 18;
|
||||
let dist[5][11] := 10;
|
||||
let dist[5][12] := 7;
|
||||
let dist[5][13] := 2;
|
||||
let dist[5][14] := 1;
|
||||
let dist[5][15] := 15;
|
||||
let dist[5][16] := 17;
|
||||
let dist[5][17] := 2;
|
||||
let dist[5][18] := 15;
|
||||
let dist[5][19] := 9;
|
||||
let dist[5][20] := 6;
|
||||
let dist[6][1] := 9;
|
||||
let dist[6][2] := 7;
|
||||
let dist[6][3] := 11;
|
||||
let dist[6][4] := 10;
|
||||
let dist[6][5] := 12;
|
||||
let dist[6][6] := 6;
|
||||
let dist[6][7] := 10;
|
||||
let dist[6][8] := 1;
|
||||
let dist[6][9] := 5;
|
||||
let dist[6][10] := 20;
|
||||
let dist[6][11] := 19;
|
||||
let dist[6][12] := 12;
|
||||
let dist[6][13] := 13;
|
||||
let dist[6][14] := 1;
|
||||
let dist[6][15] := 19;
|
||||
let dist[6][16] := 16;
|
||||
let dist[6][17] := 17;
|
||||
let dist[6][18] := 20;
|
||||
let dist[6][19] := 16;
|
||||
let dist[6][20] := 2;
|
||||
let dist[7][1] := 15;
|
||||
let dist[7][2] := 7;
|
||||
let dist[7][3] := 3;
|
||||
let dist[7][4] := 15;
|
||||
let dist[7][5] := 20;
|
||||
let dist[7][6] := 5;
|
||||
let dist[7][7] := 10;
|
||||
let dist[7][8] := 4;
|
||||
let dist[7][9] := 20;
|
||||
let dist[7][10] := 13;
|
||||
let dist[7][11] := 5;
|
||||
let dist[7][12] := 11;
|
||||
let dist[7][13] := 20;
|
||||
let dist[7][14] := 16;
|
||||
let dist[7][15] := 13;
|
||||
let dist[7][16] := 4;
|
||||
let dist[7][17] := 7;
|
||||
let dist[7][18] := 11;
|
||||
let dist[7][19] := 13;
|
||||
let dist[7][20] := 17;
|
||||
let dist[8][1] := 11;
|
||||
let dist[8][2] := 16;
|
||||
let dist[8][3] := 19;
|
||||
let dist[8][4] := 15;
|
||||
let dist[8][5] := 12;
|
||||
let dist[8][6] := 12;
|
||||
let dist[8][7] := 10;
|
||||
let dist[8][8] := 9;
|
||||
let dist[8][9] := 1;
|
||||
let dist[8][10] := 15;
|
||||
let dist[8][11] := 17;
|
||||
let dist[8][12] := 17;
|
||||
let dist[8][13] := 18;
|
||||
let dist[8][14] := 17;
|
||||
let dist[8][15] := 9;
|
||||
let dist[8][16] := 12;
|
||||
let dist[8][17] := 9;
|
||||
let dist[8][18] := 4;
|
||||
let dist[8][19] := 17;
|
||||
let dist[8][20] := 3;
|
||||
let dist[9][1] := 2;
|
||||
let dist[9][2] := 5;
|
||||
let dist[9][3] := 16;
|
||||
let dist[9][4] := 14;
|
||||
let dist[9][5] := 5;
|
||||
let dist[9][6] := 3;
|
||||
let dist[9][7] := 16;
|
||||
let dist[9][8] := 7;
|
||||
let dist[9][9] := 3;
|
||||
let dist[9][10] := 2;
|
||||
let dist[9][11] := 1;
|
||||
let dist[9][12] := 3;
|
||||
let dist[9][13] := 20;
|
||||
let dist[9][14] := 16;
|
||||
let dist[9][15] := 14;
|
||||
let dist[9][16] := 9;
|
||||
let dist[9][17] := 10;
|
||||
let dist[9][18] := 18;
|
||||
let dist[9][19] := 20;
|
||||
let dist[9][20] := 8;
|
||||
let dist[10][1] := 9;
|
||||
let dist[10][2] := 4;
|
||||
let dist[10][3] := 20;
|
||||
let dist[10][4] := 2;
|
||||
let dist[10][5] := 11;
|
||||
let dist[10][6] := 19;
|
||||
let dist[10][7] := 5;
|
||||
let dist[10][8] := 3;
|
||||
let dist[10][9] := 11;
|
||||
let dist[10][10] := 2;
|
||||
let dist[10][11] := 13;
|
||||
let dist[10][12] := 20;
|
||||
let dist[10][13] := 17;
|
||||
let dist[10][14] := 5;
|
||||
let dist[10][15] := 12;
|
||||
let dist[10][16] := 17;
|
||||
let dist[10][17] := 17;
|
||||
let dist[10][18] := 9;
|
||||
let dist[10][19] := 5;
|
||||
let dist[10][20] := 4;
|
||||
let dist[11][1] := 5;
|
||||
let dist[11][2] := 14;
|
||||
let dist[11][3] := 7;
|
||||
let dist[11][4] := 14;
|
||||
let dist[11][5] := 3;
|
||||
let dist[11][6] := 13;
|
||||
let dist[11][7] := 1;
|
||||
let dist[11][8] := 13;
|
||||
let dist[11][9] := 17;
|
||||
let dist[11][10] := 6;
|
||||
let dist[11][11] := 18;
|
||||
let dist[11][12] := 18;
|
||||
let dist[11][13] := 16;
|
||||
let dist[11][14] := 15;
|
||||
let dist[11][15] := 18;
|
||||
let dist[11][16] := 19;
|
||||
let dist[11][17] := 15;
|
||||
let dist[11][18] := 12;
|
||||
let dist[11][19] := 9;
|
||||
let dist[11][20] := 4;
|
||||
let dist[12][1] := 14;
|
||||
let dist[12][2] := 2;
|
||||
let dist[12][3] := 17;
|
||||
let dist[12][4] := 8;
|
||||
let dist[12][5] := 11;
|
||||
let dist[12][6] := 16;
|
||||
let dist[12][7] := 7;
|
||||
let dist[12][8] := 12;
|
||||
let dist[12][9] := 12;
|
||||
let dist[12][10] := 6;
|
||||
let dist[12][11] := 13;
|
||||
let dist[12][12] := 12;
|
||||
let dist[12][13] := 6;
|
||||
let dist[12][14] := 18;
|
||||
let dist[12][15] := 3;
|
||||
let dist[12][16] := 7;
|
||||
let dist[12][17] := 3;
|
||||
let dist[12][18] := 1;
|
||||
let dist[12][19] := 7;
|
||||
let dist[12][20] := 17;
|
||||
let dist[13][1] := 8;
|
||||
let dist[13][2] := 10;
|
||||
let dist[13][3] := 8;
|
||||
let dist[13][4] := 13;
|
||||
let dist[13][5] := 15;
|
||||
let dist[13][6] := 20;
|
||||
let dist[13][7] := 2;
|
||||
let dist[13][8] := 11;
|
||||
let dist[13][9] := 9;
|
||||
let dist[13][10] := 1;
|
||||
let dist[13][11] := 4;
|
||||
let dist[13][12] := 14;
|
||||
let dist[13][13] := 1;
|
||||
let dist[13][14] := 19;
|
||||
let dist[13][15] := 15;
|
||||
let dist[13][16] := 13;
|
||||
let dist[13][17] := 18;
|
||||
let dist[13][18] := 16;
|
||||
let dist[13][19] := 10;
|
||||
let dist[13][20] := 2;
|
||||
let dist[14][1] := 16;
|
||||
let dist[14][2] := 2;
|
||||
let dist[14][3] := 14;
|
||||
let dist[14][4] := 3;
|
||||
let dist[14][5] := 11;
|
||||
let dist[14][6] := 17;
|
||||
let dist[14][7] := 7;
|
||||
let dist[14][8] := 6;
|
||||
let dist[14][9] := 4;
|
||||
let dist[14][10] := 2;
|
||||
let dist[14][11] := 3;
|
||||
let dist[14][12] := 8;
|
||||
let dist[14][13] := 20;
|
||||
let dist[14][14] := 8;
|
||||
let dist[14][15] := 7;
|
||||
let dist[14][16] := 12;
|
||||
let dist[14][17] := 1;
|
||||
let dist[14][18] := 4;
|
||||
let dist[14][19] := 20;
|
||||
let dist[14][20] := 10;
|
||||
let dist[15][1] := 5;
|
||||
let dist[15][2] := 19;
|
||||
let dist[15][3] := 10;
|
||||
let dist[15][4] := 18;
|
||||
let dist[15][5] := 6;
|
||||
let dist[15][6] := 18;
|
||||
let dist[15][7] := 2;
|
||||
let dist[15][8] := 11;
|
||||
let dist[15][9] := 6;
|
||||
let dist[15][10] := 18;
|
||||
let dist[15][11] := 11;
|
||||
let dist[15][12] := 18;
|
||||
let dist[15][13] := 13;
|
||||
let dist[15][14] := 7;
|
||||
let dist[15][15] := 18;
|
||||
let dist[15][16] := 15;
|
||||
let dist[15][17] := 3;
|
||||
let dist[15][18] := 10;
|
||||
let dist[15][19] := 20;
|
||||
let dist[15][20] := 7;
|
||||
let dist[16][1] := 16;
|
||||
let dist[16][2] := 19;
|
||||
let dist[16][3] := 12;
|
||||
let dist[16][4] := 19;
|
||||
let dist[16][5] := 15;
|
||||
let dist[16][6] := 12;
|
||||
let dist[16][7] := 14;
|
||||
let dist[16][8] := 8;
|
||||
let dist[16][9] := 7;
|
||||
let dist[16][10] := 11;
|
||||
let dist[16][11] := 4;
|
||||
let dist[16][12] := 13;
|
||||
let dist[16][13] := 19;
|
||||
let dist[16][14] := 12;
|
||||
let dist[16][15] := 14;
|
||||
let dist[16][16] := 13;
|
||||
let dist[16][17] := 3;
|
||||
let dist[16][18] := 7;
|
||||
let dist[16][19] := 8;
|
||||
let dist[16][20] := 20;
|
||||
let dist[17][1] := 4;
|
||||
let dist[17][2] := 4;
|
||||
let dist[17][3] := 15;
|
||||
let dist[17][4] := 5;
|
||||
let dist[17][5] := 16;
|
||||
let dist[17][6] := 14;
|
||||
let dist[17][7] := 18;
|
||||
let dist[17][8] := 11;
|
||||
let dist[17][9] := 18;
|
||||
let dist[17][10] := 20;
|
||||
let dist[17][11] := 19;
|
||||
let dist[17][12] := 18;
|
||||
let dist[17][13] := 18;
|
||||
let dist[17][14] := 4;
|
||||
let dist[17][15] := 3;
|
||||
let dist[17][16] := 20;
|
||||
let dist[17][17] := 5;
|
||||
let dist[17][18] := 18;
|
||||
let dist[17][19] := 18;
|
||||
let dist[17][20] := 1;
|
||||
let dist[18][1] := 19;
|
||||
let dist[18][2] := 6;
|
||||
let dist[18][3] := 2;
|
||||
let dist[18][4] := 15;
|
||||
let dist[18][5] := 20;
|
||||
let dist[18][6] := 3;
|
||||
let dist[18][7] := 13;
|
||||
let dist[18][8] := 7;
|
||||
let dist[18][9] := 10;
|
||||
let dist[18][10] := 17;
|
||||
let dist[18][11] := 12;
|
||||
let dist[18][12] := 11;
|
||||
let dist[18][13] := 10;
|
||||
let dist[18][14] := 19;
|
||||
let dist[18][15] := 6;
|
||||
let dist[18][16] := 2;
|
||||
let dist[18][17] := 2;
|
||||
let dist[18][18] := 19;
|
||||
let dist[18][19] := 15;
|
||||
let dist[18][20] := 1;
|
||||
let dist[19][1] := 16;
|
||||
let dist[19][2] := 16;
|
||||
let dist[19][3] := 3;
|
||||
let dist[19][4] := 7;
|
||||
let dist[19][5] := 6;
|
||||
let dist[19][6] := 12;
|
||||
let dist[19][7] := 6;
|
||||
let dist[19][8] := 3;
|
||||
let dist[19][9] := 2;
|
||||
let dist[19][10] := 1;
|
||||
let dist[19][11] := 11;
|
||||
let dist[19][12] := 8;
|
||||
let dist[19][13] := 13;
|
||||
let dist[19][14] := 16;
|
||||
let dist[19][15] := 14;
|
||||
let dist[19][16] := 5;
|
||||
let dist[19][17] := 20;
|
||||
let dist[19][18] := 20;
|
||||
let dist[19][19] := 10;
|
||||
let dist[19][20] := 3;
|
||||
let dist[20][1] := 3;
|
||||
let dist[20][2] := 14;
|
||||
let dist[20][3] := 13;
|
||||
let dist[20][4] := 20;
|
||||
let dist[20][5] := 20;
|
||||
let dist[20][6] := 2;
|
||||
let dist[20][7] := 7;
|
||||
let dist[20][8] := 14;
|
||||
let dist[20][9] := 2;
|
||||
let dist[20][10] := 6;
|
||||
let dist[20][11] := 2;
|
||||
let dist[20][12] := 19;
|
||||
let dist[20][13] := 20;
|
||||
let dist[20][14] := 20;
|
||||
let dist[20][15] := 14;
|
||||
let dist[20][16] := 7;
|
||||
let dist[20][17] := 7;
|
||||
let dist[20][18] := 5;
|
||||
let dist[20][19] := 15;
|
||||
let dist[20][20] := 18;
|
||||
let dist[1, 1] := 8;
|
||||
let dist[1, 2] := 8;
|
||||
let dist[1, 3] := 15;
|
||||
let dist[1, 4] := 7;
|
||||
let dist[1, 5] := 11;
|
||||
let dist[1, 6] := 17;
|
||||
let dist[1, 7] := 8;
|
||||
let dist[1, 8] := 3;
|
||||
let dist[1, 9] := 4;
|
||||
let dist[1, 10] := 11;
|
||||
let dist[1, 11] := 9;
|
||||
let dist[1, 12] := 6;
|
||||
let dist[1, 13] := 2;
|
||||
let dist[1, 14] := 7;
|
||||
let dist[1, 15] := 15;
|
||||
let dist[1, 16] := 6;
|
||||
let dist[1, 17] := 16;
|
||||
let dist[1, 18] := 5;
|
||||
let dist[1, 19] := 9;
|
||||
let dist[1, 20] := 14;
|
||||
let dist[2, 1] := 16;
|
||||
let dist[2, 2] := 17;
|
||||
let dist[2, 3] := 13;
|
||||
let dist[2, 4] := 16;
|
||||
let dist[2, 5] := 15;
|
||||
let dist[2, 6] := 17;
|
||||
let dist[2, 7] := 12;
|
||||
let dist[2, 8] := 11;
|
||||
let dist[2, 9] := 7;
|
||||
let dist[2, 10] := 8;
|
||||
let dist[2, 11] := 13;
|
||||
let dist[2, 12] := 3;
|
||||
let dist[2, 13] := 7;
|
||||
let dist[2, 14] := 15;
|
||||
let dist[2, 15] := 9;
|
||||
let dist[2, 16] := 8;
|
||||
let dist[2, 17] := 16;
|
||||
let dist[2, 18] := 18;
|
||||
let dist[2, 19] := 7;
|
||||
let dist[2, 20] := 5;
|
||||
let dist[3, 1] := 16;
|
||||
let dist[3, 2] := 4;
|
||||
let dist[3, 3] := 1;
|
||||
let dist[3, 4] := 9;
|
||||
let dist[3, 5] := 17;
|
||||
let dist[3, 6] := 11;
|
||||
let dist[3, 7] := 18;
|
||||
let dist[3, 8] := 2;
|
||||
let dist[3, 9] := 16;
|
||||
let dist[3, 10] := 13;
|
||||
let dist[3, 11] := 6;
|
||||
let dist[3, 12] := 5;
|
||||
let dist[3, 13] := 2;
|
||||
let dist[3, 14] := 7;
|
||||
let dist[3, 15] := 18;
|
||||
let dist[3, 16] := 16;
|
||||
let dist[3, 17] := 19;
|
||||
let dist[3, 18] := 14;
|
||||
let dist[3, 19] := 14;
|
||||
let dist[3, 20] := 9;
|
||||
let dist[4, 1] := 9;
|
||||
let dist[4, 2] := 9;
|
||||
let dist[4, 3] := 7;
|
||||
let dist[4, 4] := 12;
|
||||
let dist[4, 5] := 16;
|
||||
let dist[4, 6] := 12;
|
||||
let dist[4, 7] := 3;
|
||||
let dist[4, 8] := 5;
|
||||
let dist[4, 9] := 16;
|
||||
let dist[4, 10] := 18;
|
||||
let dist[4, 11] := 10;
|
||||
let dist[4, 12] := 7;
|
||||
let dist[4, 13] := 6;
|
||||
let dist[4, 14] := 12;
|
||||
let dist[4, 15] := 4;
|
||||
let dist[4, 16] := 5;
|
||||
let dist[4, 17] := 14;
|
||||
let dist[4, 18] := 11;
|
||||
let dist[4, 19] := 5;
|
||||
let dist[4, 20] := 5;
|
||||
let dist[5, 1] := 5;
|
||||
let dist[5, 2] := 2;
|
||||
let dist[5, 3] := 16;
|
||||
let dist[5, 4] := 18;
|
||||
let dist[5, 5] := 15;
|
||||
let dist[5, 6] := 15;
|
||||
let dist[5, 7] := 8;
|
||||
let dist[5, 8] := 10;
|
||||
let dist[5, 9] := 15;
|
||||
let dist[5, 10] := 18;
|
||||
let dist[5, 11] := 10;
|
||||
let dist[5, 12] := 7;
|
||||
let dist[5, 13] := 2;
|
||||
let dist[5, 14] := 1;
|
||||
let dist[5, 15] := 15;
|
||||
let dist[5, 16] := 17;
|
||||
let dist[5, 17] := 2;
|
||||
let dist[5, 18] := 15;
|
||||
let dist[5, 19] := 9;
|
||||
let dist[5, 20] := 6;
|
||||
let dist[6, 1] := 9;
|
||||
let dist[6, 2] := 7;
|
||||
let dist[6, 3] := 11;
|
||||
let dist[6, 4] := 10;
|
||||
let dist[6, 5] := 12;
|
||||
let dist[6, 6] := 6;
|
||||
let dist[6, 7] := 10;
|
||||
let dist[6, 8] := 1;
|
||||
let dist[6, 9] := 5;
|
||||
let dist[6, 10] := 20;
|
||||
let dist[6, 11] := 19;
|
||||
let dist[6, 12] := 12;
|
||||
let dist[6, 13] := 13;
|
||||
let dist[6, 14] := 1;
|
||||
let dist[6, 15] := 19;
|
||||
let dist[6, 16] := 16;
|
||||
let dist[6, 17] := 17;
|
||||
let dist[6, 18] := 20;
|
||||
let dist[6, 19] := 16;
|
||||
let dist[6, 20] := 2;
|
||||
let dist[7, 1] := 15;
|
||||
let dist[7, 2] := 7;
|
||||
let dist[7, 3] := 3;
|
||||
let dist[7, 4] := 15;
|
||||
let dist[7, 5] := 20;
|
||||
let dist[7, 6] := 5;
|
||||
let dist[7, 7] := 10;
|
||||
let dist[7, 8] := 4;
|
||||
let dist[7, 9] := 20;
|
||||
let dist[7, 10] := 13;
|
||||
let dist[7, 11] := 5;
|
||||
let dist[7, 12] := 11;
|
||||
let dist[7, 13] := 20;
|
||||
let dist[7, 14] := 16;
|
||||
let dist[7, 15] := 13;
|
||||
let dist[7, 16] := 4;
|
||||
let dist[7, 17] := 7;
|
||||
let dist[7, 18] := 11;
|
||||
let dist[7, 19] := 13;
|
||||
let dist[7, 20] := 17;
|
||||
let dist[8, 1] := 11;
|
||||
let dist[8, 2] := 16;
|
||||
let dist[8, 3] := 19;
|
||||
let dist[8, 4] := 15;
|
||||
let dist[8, 5] := 12;
|
||||
let dist[8, 6] := 12;
|
||||
let dist[8, 7] := 10;
|
||||
let dist[8, 8] := 9;
|
||||
let dist[8, 9] := 1;
|
||||
let dist[8, 10] := 15;
|
||||
let dist[8, 11] := 17;
|
||||
let dist[8, 12] := 17;
|
||||
let dist[8, 13] := 18;
|
||||
let dist[8, 14] := 17;
|
||||
let dist[8, 15] := 9;
|
||||
let dist[8, 16] := 12;
|
||||
let dist[8, 17] := 9;
|
||||
let dist[8, 18] := 4;
|
||||
let dist[8, 19] := 17;
|
||||
let dist[8, 20] := 3;
|
||||
let dist[9, 1] := 2;
|
||||
let dist[9, 2] := 5;
|
||||
let dist[9, 3] := 16;
|
||||
let dist[9, 4] := 14;
|
||||
let dist[9, 5] := 5;
|
||||
let dist[9, 6] := 3;
|
||||
let dist[9, 7] := 16;
|
||||
let dist[9, 8] := 7;
|
||||
let dist[9, 9] := 3;
|
||||
let dist[9, 10] := 2;
|
||||
let dist[9, 11] := 1;
|
||||
let dist[9, 12] := 3;
|
||||
let dist[9, 13] := 20;
|
||||
let dist[9, 14] := 16;
|
||||
let dist[9, 15] := 14;
|
||||
let dist[9, 16] := 9;
|
||||
let dist[9, 17] := 10;
|
||||
let dist[9, 18] := 18;
|
||||
let dist[9, 19] := 20;
|
||||
let dist[9, 20] := 8;
|
||||
let dist[10, 1] := 9;
|
||||
let dist[10, 2] := 4;
|
||||
let dist[10, 3] := 20;
|
||||
let dist[10, 4] := 2;
|
||||
let dist[10, 5] := 11;
|
||||
let dist[10, 6] := 19;
|
||||
let dist[10, 7] := 5;
|
||||
let dist[10, 8] := 3;
|
||||
let dist[10, 9] := 11;
|
||||
let dist[10, 10] := 2;
|
||||
let dist[10, 11] := 13;
|
||||
let dist[10, 12] := 20;
|
||||
let dist[10, 13] := 17;
|
||||
let dist[10, 14] := 5;
|
||||
let dist[10, 15] := 12;
|
||||
let dist[10, 16] := 17;
|
||||
let dist[10, 17] := 17;
|
||||
let dist[10, 18] := 9;
|
||||
let dist[10, 19] := 5;
|
||||
let dist[10, 20] := 4;
|
||||
let dist[11, 1] := 5;
|
||||
let dist[11, 2] := 14;
|
||||
let dist[11, 3] := 7;
|
||||
let dist[11, 4] := 14;
|
||||
let dist[11, 5] := 3;
|
||||
let dist[11, 6] := 13;
|
||||
let dist[11, 7] := 1;
|
||||
let dist[11, 8] := 13;
|
||||
let dist[11, 9] := 17;
|
||||
let dist[11, 10] := 6;
|
||||
let dist[11, 11] := 18;
|
||||
let dist[11, 12] := 18;
|
||||
let dist[11, 13] := 16;
|
||||
let dist[11, 14] := 15;
|
||||
let dist[11, 15] := 18;
|
||||
let dist[11, 16] := 19;
|
||||
let dist[11, 17] := 15;
|
||||
let dist[11, 18] := 12;
|
||||
let dist[11, 19] := 9;
|
||||
let dist[11, 20] := 4;
|
||||
let dist[12, 1] := 14;
|
||||
let dist[12, 2] := 2;
|
||||
let dist[12, 3] := 17;
|
||||
let dist[12, 4] := 8;
|
||||
let dist[12, 5] := 11;
|
||||
let dist[12, 6] := 16;
|
||||
let dist[12, 7] := 7;
|
||||
let dist[12, 8] := 12;
|
||||
let dist[12, 9] := 12;
|
||||
let dist[12, 10] := 6;
|
||||
let dist[12, 11] := 13;
|
||||
let dist[12, 12] := 12;
|
||||
let dist[12, 13] := 6;
|
||||
let dist[12, 14] := 18;
|
||||
let dist[12, 15] := 3;
|
||||
let dist[12, 16] := 7;
|
||||
let dist[12, 17] := 3;
|
||||
let dist[12, 18] := 1;
|
||||
let dist[12, 19] := 7;
|
||||
let dist[12, 20] := 17;
|
||||
let dist[13, 1] := 8;
|
||||
let dist[13, 2] := 10;
|
||||
let dist[13, 3] := 8;
|
||||
let dist[13, 4] := 13;
|
||||
let dist[13, 5] := 15;
|
||||
let dist[13, 6] := 20;
|
||||
let dist[13, 7] := 2;
|
||||
let dist[13, 8] := 11;
|
||||
let dist[13, 9] := 9;
|
||||
let dist[13, 10] := 1;
|
||||
let dist[13, 11] := 4;
|
||||
let dist[13, 12] := 14;
|
||||
let dist[13, 13] := 1;
|
||||
let dist[13, 14] := 19;
|
||||
let dist[13, 15] := 15;
|
||||
let dist[13, 16] := 13;
|
||||
let dist[13, 17] := 18;
|
||||
let dist[13, 18] := 16;
|
||||
let dist[13, 19] := 10;
|
||||
let dist[13, 20] := 2;
|
||||
let dist[14, 1] := 16;
|
||||
let dist[14, 2] := 2;
|
||||
let dist[14, 3] := 14;
|
||||
let dist[14, 4] := 3;
|
||||
let dist[14, 5] := 11;
|
||||
let dist[14, 6] := 17;
|
||||
let dist[14, 7] := 7;
|
||||
let dist[14, 8] := 6;
|
||||
let dist[14, 9] := 4;
|
||||
let dist[14, 10] := 2;
|
||||
let dist[14, 11] := 3;
|
||||
let dist[14, 12] := 8;
|
||||
let dist[14, 13] := 20;
|
||||
let dist[14, 14] := 8;
|
||||
let dist[14, 15] := 7;
|
||||
let dist[14, 16] := 12;
|
||||
let dist[14, 17] := 1;
|
||||
let dist[14, 18] := 4;
|
||||
let dist[14, 19] := 20;
|
||||
let dist[14, 20] := 10;
|
||||
let dist[15, 1] := 5;
|
||||
let dist[15, 2] := 19;
|
||||
let dist[15, 3] := 10;
|
||||
let dist[15, 4] := 18;
|
||||
let dist[15, 5] := 6;
|
||||
let dist[15, 6] := 18;
|
||||
let dist[15, 7] := 2;
|
||||
let dist[15, 8] := 11;
|
||||
let dist[15, 9] := 6;
|
||||
let dist[15, 10] := 18;
|
||||
let dist[15, 11] := 11;
|
||||
let dist[15, 12] := 18;
|
||||
let dist[15, 13] := 13;
|
||||
let dist[15, 14] := 7;
|
||||
let dist[15, 15] := 18;
|
||||
let dist[15, 16] := 15;
|
||||
let dist[15, 17] := 3;
|
||||
let dist[15, 18] := 10;
|
||||
let dist[15, 19] := 20;
|
||||
let dist[15, 20] := 7;
|
||||
let dist[16, 1] := 16;
|
||||
let dist[16, 2] := 19;
|
||||
let dist[16, 3] := 12;
|
||||
let dist[16, 4] := 19;
|
||||
let dist[16, 5] := 15;
|
||||
let dist[16, 6] := 12;
|
||||
let dist[16, 7] := 14;
|
||||
let dist[16, 8] := 8;
|
||||
let dist[16, 9] := 7;
|
||||
let dist[16, 10] := 11;
|
||||
let dist[16, 11] := 4;
|
||||
let dist[16, 12] := 13;
|
||||
let dist[16, 13] := 19;
|
||||
let dist[16, 14] := 12;
|
||||
let dist[16, 15] := 14;
|
||||
let dist[16, 16] := 13;
|
||||
let dist[16, 17] := 3;
|
||||
let dist[16, 18] := 7;
|
||||
let dist[16, 19] := 8;
|
||||
let dist[16, 20] := 20;
|
||||
let dist[17, 1] := 4;
|
||||
let dist[17, 2] := 4;
|
||||
let dist[17, 3] := 15;
|
||||
let dist[17, 4] := 5;
|
||||
let dist[17, 5] := 16;
|
||||
let dist[17, 6] := 14;
|
||||
let dist[17, 7] := 18;
|
||||
let dist[17, 8] := 11;
|
||||
let dist[17, 9] := 18;
|
||||
let dist[17, 10] := 20;
|
||||
let dist[17, 11] := 19;
|
||||
let dist[17, 12] := 18;
|
||||
let dist[17, 13] := 18;
|
||||
let dist[17, 14] := 4;
|
||||
let dist[17, 15] := 3;
|
||||
let dist[17, 16] := 20;
|
||||
let dist[17, 17] := 5;
|
||||
let dist[17, 18] := 18;
|
||||
let dist[17, 19] := 18;
|
||||
let dist[17, 20] := 1;
|
||||
let dist[18, 1] := 19;
|
||||
let dist[18, 2] := 6;
|
||||
let dist[18, 3] := 2;
|
||||
let dist[18, 4] := 15;
|
||||
let dist[18, 5] := 20;
|
||||
let dist[18, 6] := 3;
|
||||
let dist[18, 7] := 13;
|
||||
let dist[18, 8] := 7;
|
||||
let dist[18, 9] := 10;
|
||||
let dist[18, 10] := 17;
|
||||
let dist[18, 11] := 12;
|
||||
let dist[18, 12] := 11;
|
||||
let dist[18, 13] := 10;
|
||||
let dist[18, 14] := 19;
|
||||
let dist[18, 15] := 6;
|
||||
let dist[18, 16] := 2;
|
||||
let dist[18, 17] := 2;
|
||||
let dist[18, 18] := 19;
|
||||
let dist[18, 19] := 15;
|
||||
let dist[18, 20] := 1;
|
||||
let dist[19, 1] := 16;
|
||||
let dist[19, 2] := 16;
|
||||
let dist[19, 3] := 3;
|
||||
let dist[19, 4] := 7;
|
||||
let dist[19, 5] := 6;
|
||||
let dist[19, 6] := 12;
|
||||
let dist[19, 7] := 6;
|
||||
let dist[19, 8] := 3;
|
||||
let dist[19, 9] := 2;
|
||||
let dist[19, 10] := 1;
|
||||
let dist[19, 11] := 11;
|
||||
let dist[19, 12] := 8;
|
||||
let dist[19, 13] := 13;
|
||||
let dist[19, 14] := 16;
|
||||
let dist[19, 15] := 14;
|
||||
let dist[19, 16] := 5;
|
||||
let dist[19, 17] := 20;
|
||||
let dist[19, 18] := 20;
|
||||
let dist[19, 19] := 10;
|
||||
let dist[19, 20] := 3;
|
||||
let dist[20, 1] := 3;
|
||||
let dist[20, 2] := 14;
|
||||
let dist[20, 3] := 13;
|
||||
let dist[20, 4] := 20;
|
||||
let dist[20, 5] := 20;
|
||||
let dist[20, 6] := 2;
|
||||
let dist[20, 7] := 7;
|
||||
let dist[20, 8] := 14;
|
||||
let dist[20, 9] := 2;
|
||||
let dist[20, 10] := 6;
|
||||
let dist[20, 11] := 2;
|
||||
let dist[20, 12] := 19;
|
||||
let dist[20, 13] := 20;
|
||||
let dist[20, 14] := 20;
|
||||
let dist[20, 15] := 14;
|
||||
let dist[20, 16] := 7;
|
||||
let dist[20, 17] := 7;
|
||||
let dist[20, 18] := 5;
|
||||
let dist[20, 19] := 15;
|
||||
let dist[20, 20] := 18;
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
let dist[1][1] := 5;
|
||||
let dist[1][2] := 10;
|
||||
let dist[1][3] := 15;
|
||||
let dist[1][4] := 2;
|
||||
let dist[1][5] := 6;
|
||||
let dist[2][1] := 12;
|
||||
let dist[2][2] := 2;
|
||||
let dist[2][3] := 17;
|
||||
let dist[2][4] := 5;
|
||||
let dist[2][5] := 3;
|
||||
let dist[3][1] := 9;
|
||||
let dist[3][2] := 5;
|
||||
let dist[3][3] := 13;
|
||||
let dist[3][4] := 16;
|
||||
let dist[3][5] := 7;
|
||||
let dist[4][1] := 7;
|
||||
let dist[4][2] := 18;
|
||||
let dist[4][3] := 19;
|
||||
let dist[4][4] := 1;
|
||||
let dist[4][5] := 5;
|
||||
let dist[5][1] := 17;
|
||||
let dist[5][2] := 7;
|
||||
let dist[5][3] := 15;
|
||||
let dist[5][4] := 15;
|
||||
let dist[5][5] := 6;
|
||||
let dist[1, 1] := 5;
|
||||
let dist[1, 2] := 10;
|
||||
let dist[1, 3] := 15;
|
||||
let dist[1, 4] := 2;
|
||||
let dist[1, 5] := 6;
|
||||
let dist[2, 1] := 12;
|
||||
let dist[2, 2] := 2;
|
||||
let dist[2, 3] := 17;
|
||||
let dist[2, 4] := 5;
|
||||
let dist[2, 5] := 3;
|
||||
let dist[3, 1] := 9;
|
||||
let dist[3, 2] := 5;
|
||||
let dist[3, 3] := 13;
|
||||
let dist[3, 4] := 16;
|
||||
let dist[3, 5] := 7;
|
||||
let dist[4, 1] := 7;
|
||||
let dist[4, 2] := 18;
|
||||
let dist[4, 3] := 19;
|
||||
let dist[4, 4] := 1;
|
||||
let dist[4, 5] := 5;
|
||||
let dist[5, 1] := 17;
|
||||
let dist[5, 2] := 7;
|
||||
let dist[5, 3] := 15;
|
||||
let dist[5, 4] := 15;
|
||||
let dist[5, 5] := 6;
|
||||
|
|
|
@ -17,7 +17,7 @@ for i in range(x):
|
|||
file1.write("edge({}, {}, {}).\n".format(str(chr(ord('a') + i)), str(chr(ord('a') + j)), k))
|
||||
file4.write("edge({}, {}, {}).\n".format(str(chr(ord('a') + i)), str(chr(ord('a') + j)), k))
|
||||
file2.write(str(k))
|
||||
file3.write("let dist[{}][{}] := {};\n".format(i+1, j+1,k))
|
||||
file3.write("let dist[{}, {}] := {};\n".format(i+1, j+1,k))
|
||||
if j != x - 1: file2.write(", ")
|
||||
file2.write('],\n')
|
||||
file2.write(']')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
param N := 6;
|
||||
param N := 20;
|
||||
|
||||
var m{1..N};
|
||||
|
||||
|
@ -18,7 +18,7 @@ C3{i in 2..N, j in 2..N: i <> j}: m[i]-m[j]+N*x[i,j]<=N-1;
|
|||
C4{i in 2..N}: m[i]<=N-1;
|
||||
|
||||
|
||||
data tsp.dat;
|
||||
data data20.dat;
|
||||
option solver cplex;
|
||||
solve;
|
||||
display Total;
|
||||
|
|
|
@ -2,19 +2,33 @@
|
|||
|
||||
from ortools.constraint_solver import routing_enums_pb2
|
||||
from ortools.constraint_solver import pywrapcp
|
||||
|
||||
import timeit
|
||||
|
||||
def create_data_model():
|
||||
"""Stores the data for the problem."""
|
||||
data = {}
|
||||
data["distance_matrix"] = [
|
||||
[99, 2, 3, 1, 99, 99],
|
||||
[99, 99, 99, 2, 2, 4],
|
||||
[3, 99, 99, 2, 2, 99],
|
||||
[1, 2, 99, 99, 99, 99],
|
||||
[99, 99, 2, 2, 99, 1],
|
||||
[99, 4, 3, 99, 1, 99],
|
||||
]
|
||||
data["distance_matrix"] = [
|
||||
[8, 8, 15, 7, 11, 17, 8, 3, 4, 11, 9, 6, 2, 7, 15, 6, 16, 5, 9, 14],
|
||||
[16, 17, 13, 16, 15, 17, 12, 11, 7, 8, 13, 3, 7, 15, 9, 8, 16, 18, 7, 5],
|
||||
[16, 4, 1, 9, 17, 11, 18, 2, 16, 13, 6, 5, 2, 7, 18, 16, 19, 14, 14, 9],
|
||||
[9, 9, 7, 12, 16, 12, 3, 5, 16, 18, 10, 7, 6, 12, 4, 5, 14, 11, 5, 5],
|
||||
[5, 2, 16, 18, 15, 15, 8, 10, 15, 18, 10, 7, 2, 1, 15, 17, 2, 15, 9, 6],
|
||||
[9, 7, 11, 10, 12, 6, 10, 1, 5, 20, 19, 12, 13, 1, 19, 16, 17, 20, 16, 2],
|
||||
[15, 7, 3, 15, 20, 5, 10, 4, 20, 13, 5, 11, 20, 16, 13, 4, 7, 11, 13, 17],
|
||||
[11, 16, 19, 15, 12, 12, 10, 9, 1, 15, 17, 17, 18, 17, 9, 12, 9, 4, 17, 3],
|
||||
[2, 5, 16, 14, 5, 3, 16, 7, 3, 2, 1, 3, 20, 16, 14, 9, 10, 18, 20, 8],
|
||||
[9, 4, 20, 2, 11, 19, 5, 3, 11, 2, 13, 20, 17, 5, 12, 17, 17, 9, 5, 4],
|
||||
[5, 14, 7, 14, 3, 13, 1, 13, 17, 6, 18, 18, 16, 15, 18, 19, 15, 12, 9, 4],
|
||||
[14, 2, 17, 8, 11, 16, 7, 12, 12, 6, 13, 12, 6, 18, 3, 7, 3, 1, 7, 17],
|
||||
[8, 10, 8, 13, 15, 20, 2, 11, 9, 1, 4, 14, 1, 19, 15, 13, 18, 16, 10, 2],
|
||||
[16, 2, 14, 3, 11, 17, 7, 6, 4, 2, 3, 8, 20, 8, 7, 12, 1, 4, 20, 10],
|
||||
[5, 19, 10, 18, 6, 18, 2, 11, 6, 18, 11, 18, 13, 7, 18, 15, 3, 10, 20, 7],
|
||||
[16, 19, 12, 19, 15, 12, 14, 8, 7, 11, 4, 13, 19, 12, 14, 13, 3, 7, 8, 20],
|
||||
[4, 4, 15, 5, 16, 14, 18, 11, 18, 20, 19, 18, 18, 4, 3, 20, 5, 18, 18, 1],
|
||||
[19, 6, 2, 15, 20, 3, 13, 7, 10, 17, 12, 11, 10, 19, 6, 2, 2, 19, 15, 1],
|
||||
[16, 16, 3, 7, 6, 12, 6, 3, 2, 1, 11, 8, 13, 16, 14, 5, 20, 20, 10, 3],
|
||||
[3, 14, 13, 20, 20, 2, 7, 14, 2, 6, 2, 19, 20, 20, 14, 7, 7, 5, 15, 18],
|
||||
]
|
||||
data["num_vehicles"] = 1
|
||||
data["depot"] = 0
|
||||
return data
|
||||
|
@ -63,10 +77,17 @@ def main():
|
|||
routing.SetArcCostEvaluatorOfAllVehicles(transit_callback_index)
|
||||
|
||||
# Setting first solution heuristic.
|
||||
# Local Optimum
|
||||
# search_parameters = pywrapcp.DefaultRoutingSearchParameters()
|
||||
# search_parameters.first_solution_strategy = (
|
||||
# routing_enums_pb2.FirstSolutionStrategy.PATH_CHEAPEST_ARC
|
||||
# )
|
||||
# Global Optimum
|
||||
search_parameters = pywrapcp.DefaultRoutingSearchParameters()
|
||||
search_parameters.first_solution_strategy = (
|
||||
routing_enums_pb2.FirstSolutionStrategy.PATH_CHEAPEST_ARC
|
||||
)
|
||||
search_parameters.local_search_metaheuristic = (
|
||||
routing_enums_pb2.LocalSearchMetaheuristic.GUIDED_LOCAL_SEARCH)
|
||||
search_parameters.time_limit.seconds = 30
|
||||
search_parameters.log_search = True
|
||||
|
||||
# Solve the problem.
|
||||
solution = routing.SolveWithParameters(search_parameters)
|
||||
|
@ -77,4 +98,7 @@ def main():
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
start = timeit.default_timer()
|
||||
main()
|
||||
stop = timeit.default_timer()
|
||||
print('Time: ', stop - start)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
"""Solves a simple assignment problem."""
|
||||
from ortools.sat.python import cp_model
|
||||
|
||||
import timeit
|
||||
|
||||
def main() -> None:
|
||||
# Data
|
||||
costs = [10,5,8,10,5,2,1]
|
||||
num_workers = 2
|
||||
deadline = 20
|
||||
costs = [1, 19, 21, 8, 6, 24, 17, 23, 15, 22, 14, 2, 2, 10, 3, 17, 17, 19, 26, 9, 28, 16, 22, 19, 17, 15, 18, 15, 23, 27]
|
||||
num_workers = 8
|
||||
deadline = 90
|
||||
num_tasks = len(costs)
|
||||
|
||||
# Model
|
||||
|
@ -47,4 +47,7 @@ def main() -> None:
|
|||
print("No solution found.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
start = timeit.default_timer()
|
||||
main()
|
||||
stop = timeit.default_timer()
|
||||
print('Time: ', stop - start)
|
|
@ -1,8 +1,8 @@
|
|||
param: WIDTHS: orders:=
|
||||
6.77 10
|
||||
7.56 40
|
||||
17.46 33
|
||||
18.76 10 ;
|
||||
6.77 25
|
||||
7.56 25
|
||||
17.46 25
|
||||
18.76 25 ;
|
||||
|
||||
param nPAT := 9 ;
|
||||
|
||||
|
|
|
@ -18,3 +18,4 @@ solve;
|
|||
option omit_zero_rows 1;
|
||||
option display_1col 0;
|
||||
display Cut;
|
||||
display Number;
|
|
@ -27,14 +27,36 @@ I didn't find a way to calculate runtime in swi-prolog. But it is clearly to see
|
|||
|
||||
|
||||
### Google OR-Tools
|
||||
| size | ans | time |
|
||||
| ---- | --- | ---- |
|
||||
|
||||
1. Local Optimum
|
||||
|
||||
| size | ans | time |
|
||||
| ---- | --- | ------ |
|
||||
| 5 | 38 | 0.0077 |
|
||||
| 10 | 48 | 0.0085 |
|
||||
| 15 | 37 | 0.009 |
|
||||
| 20 | 48 | 0.010 |
|
||||
|
||||
2. Global Optimum
|
||||
|
||||
| size | ans | time |
|
||||
| ---- | --- | ------------------- |
|
||||
| 5 | 38 | time limit exceeded |
|
||||
| 10 | 48 | time limit exceeded |
|
||||
| 15 | 29 | time limit exceeded |
|
||||
| 20 | 46 | time limit exceeded |
|
||||
|
||||
It is great to have two different mode. Though the approximate result is not as good as the exact one. But it is way faster and uses way less resource. We can switch between different mode at different case.
|
||||
|
||||
### AMPL
|
||||
| size | ans | time |
|
||||
| ---- | --- | ---- |
|
||||
| size | ans | time |
|
||||
| ---- | --- | --------- |
|
||||
| 5 | 38 | very fast |
|
||||
| 10 | 48 | very fast |
|
||||
| 15 | 29 | very fast |
|
||||
| 20 | 46 | very fast |
|
||||
|
||||
Very fast.
|
||||
|
||||
## Part B
|
||||
### clingo
|
||||
|
@ -55,7 +77,17 @@ clingo task.lp
|
|||
With either too high or too low constrain, the runtime grows exponentially. If the constrain is too low, it must iterate through all answers to find one correct result. If it is too high, then it may waste too much time fill the first processor.
|
||||
|
||||
### Google OR-Tools
|
||||
| size | processors | deadline | result | time |
|
||||
| ---- | ---------- | -------- | ------ | ------ |
|
||||
| 10 | 3 | 20 | yes | 0.035 |
|
||||
| 20 | 6 | 30 | no | 0.037 |
|
||||
| 20 | 8 | 30 | yes | 0.0474 |
|
||||
| 30 | 6 | 60 | no | 0.0413 |
|
||||
| 30 | 8 | 60 | yes | 0.0469 |
|
||||
| 30 | 8 | 80 | yes | 0.0481 |
|
||||
| 30 | 8 | 90 | yes | 0.0552 |
|
||||
|
||||
Unlike clingo, Google OR-Tools is much faster on this question. And too high/low constrain does not increase the run time by a lot.
|
||||
|
||||
## Part C
|
||||
### clingo
|
||||
|
@ -74,5 +106,17 @@ clingo cut.lp
|
|||
One important factor of the runtime is the max number of cut to check. If we set max = 10 with size = 30, we get the time of 0.914. However, it is impossible to get the max size before running, I believe this time would be a great representation of the runtime of clingo.
|
||||
|
||||
### AMPL
|
||||
| size | ans | time |
|
||||
| ---- | --- | ---- |
|
||||
| size | ans | time |
|
||||
| ------ | ----- | --------- |
|
||||
| 5 | 5 | very fast |
|
||||
| 10 | 9 | very fast |
|
||||
| 15 | 13 | very fast |
|
||||
| 20 | 17 | very fast |
|
||||
| 25 | 21 | very fast |
|
||||
| 30 | 25 | very fast |
|
||||
| 100000 | 80393 | very fast |
|
||||
|
||||
Very fast.
|
||||
|
||||
## Conclusion
|
||||
AMPL is the fastest implementation in part 1 and 3, much faster than the others. clingo is the clearest and the easiest way to write it but it is not that fastest one. Each language has its own pros and cons so it is hard to create a single language with all the pros but no cons.
|
Loading…
Reference in New Issue
Block a user