def __init__(self, n, Qpenalty, nineq):
super().__init__()
nx = (n**2)**3
self.Q = Variable(Qpenalty*torch.eye(nx).double().cuda())
self.G1 = Variable(-torch.eye(nx).double().cuda())
self.h1 = Variable(torch.zeros(nx).double().cuda())
# if trueInit:
# self.A = Parameter(torch.DoubleTensor(get_sudoku_matrix(n)).cuda())
# else:
# # t = get_sudoku_matrix(n)
# # self.A = Parameter(torch.rand(t.shape).double().cuda())
# # import IPython, sys; IPython.embed(); sys.exit(-1)
self.A = Parameter(torch.rand(50,nx).double().cuda())
self.G2 = Parameter(torch.Tensor(128, nx).uniform_(-1,1).double().cuda())
self.z2 = Parameter(torch.zeros(nx).double().cuda())
self.s2 = Parameter(torch.ones(128).double().cuda())
# self.b = Variable(torch.ones(self.A.size(0)).double().cuda())
评论列表
文章目录