我有10个节点。如本矢量所示,每个节点都有已知数量的收发器:
[8 3 3 3 3 3 2 1 1 1]其中:8是第1节点的收发器数,3是第2节点的收发器数,等等。
每个收发信机一次只能从一个源接收。要求所有收发器必须同时使用。允许同一节点使用多个收发信机向有足够多收发器接收的另一个节点发送。一个收发器不可能被认为是在向多个收发器发送。
我想知道如何获得节点之间的所有可能的连接,以及每个获得的连接矩阵,识别连接节点之间使用的收发器的数量?
发布于 2017-06-03 17:25:35
我不知道如何在Matlab中做到这一点。
使用米尼辛,我找到了以下解决方案(使用Microsoft Word稍微按摩一下):

注意,我使用节点号0..9而不是1..10来压缩矩阵文本。有大量可能的解决办法。这只是其中之一。
米尼辛 脚本:
include "globals.mzn";
set of int: Transceivers = 1..28;
set of int: Nodes = 1..10;
array[Transceivers] of Nodes: node = [1,1,1,1,1,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,8,9,10];
array[Transceivers] of Nodes: seq = [1,2,3,4,5,6,7,8,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,1,1,1];
array[Transceivers] of var Transceivers: aTo;
array[Nodes, Nodes] of var Transceivers: connections;
% Each transceiver can only receive from one source at a time
constraint all_different([aTo[t] | t in Transceivers]);
% transceivers have to connect to other nodes rather than to their own node
constraint
forall(t in Transceivers)
(node[aTo[t]] != node[t]);
% no more than 1 connection between any pair of nodes
constraint
forall(i in Nodes, j in Nodes where j > i)
(sum([bool2int((node[t] == i) /\ (node[aTo[t]] == j)) | t in Transceivers]) < 2);
solve satisfy;
output [" "] ++ [ show(node[i]-1) ++ "." ++ show(seq[i]) ++ " | " | i in Transceivers] ++
[ if j == 1 then ("\n" ++ show(node[i]-1) ++ "." ++ show(seq[i]) ++ ": ") else "" endif ++
if fix(aTo[i]) == j then " x | " else " | " endif
| i in Transceivers, j in Transceivers ];https://stackoverflow.com/questions/44343631
复制相似问题