Example #1
0
    def solve(self):
        bx = self.lp.bx.get_cvx()
        bc = self.lp.bc.get_cvx()

        X = coneqp(P=self.Q, q=self.lp.c)

        X.aux.pushLinConstraint(bx['mat'], bx['vec'])
        X.aux.pushLinConstraint(bc['mat'], bc['vec'])

        return X.solve()
Example #2
0
    def solve(self):
        c = numpy.concatenate([self.qp.lp.c, self.penalty.v])
        Q = numpy.zeros((len(c), len(c)))
        Q[0:len(self.qp.lp.c), 0:len(self.qp.lp.c)] = self.qp.Q

        X = coneqp(P=Q, q=c)

        bx = self.qp.lp.bx.get_cvx()
        bc = self.qp.lp.bc.get_cvx()
        p = self.penalty.getCVX()

        X.aux.pushLinConstraint(numpy.hstack([bx['mat'], numpy.zeros(bx['mat'].shape)]), bx['vec'])
        X.aux.pushLinConstraint(numpy.hstack([bc['mat'], numpy.zeros(bc['mat'].shape)]), bc['vec'])
        X.aux.pushLinConstraint(p['mat'], p['vec'])

        x = X.solve()
        return x[0][0:len(self.qp.lp.c)], x[1]