Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def foe_function(self, q_values_1):
- trans = matrix(q_values_1).trans()
- row, size = trans.size
- a = np.hstack((np.ones((row, 1)), trans))
- a = np.vstack((a, np.hstack((np.zeros((size, 1)), np.eye(size) * -1.0))))
- a = matrix(np.vstack((a, np.concatenate(([0.0],np.ones(size) ) ), np.concatenate(([0.0],-np.ones(size))))))
- b = matrix(np.array([0. for _ in xrange(a.size[0] - 2)] + [1., -1.], dtype='float'))
- c = matrix(np.array([-1.] + [0. for _ in xrange(size)], dtype='float'))
- sol = solvers.lp(c,a,b, solver=self.solver)
- sol_value = sol['primal objective'] #np.min(np.array(sol["x"])) * -1 #[x[0] for x in np.array(sol["x"])]
- return sol_value
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement