示例#1
0
    - Nmax : max nb of objects in a cluster
    - W^k in W : . matrix of profits for cluster k (in position (i,j), you got the sum of the similarities for the objects i and j)
            . shape : N*N
Result:
    - X^k in X : Matrix of objects (in position (i,j), you got x_i^k * x_j^k)

'''

#Global variables :

# K = 2
# N = 3
# Nmax = N-1
# W = [[[1, 0, 0], [0, 1, 0], [0, 0, 1]], [[1, 2, 1], [0, 0, 0], [1, 2, 1]]]

I = Instance.LoadInstance("save3.txt")
K = I.K
N = I.N
Nmax = I.Nmax
W = I.Wmulti
M = I.M
Mmax = I.Mmax


def initProblem(N, K, Nmax):  #Cette version n'est pas aléatoire uniforme

    if (K < ceil(N / Nmax)):
        raise ValueError('Trop peu de clusters pour le Nmax donné')
        return

    if (K > N):