/usr/lib/python2.7/dist-packages/openopt/solvers/Standalone/pointProjection.py is in python-openopt 0.38+svn1589-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | from numpy import *
from openopt import *
def pointProjection(x, lb, ub, A, b, Aeq, beq):
# projection of x to set of linear constraints
n = x.size
# TODO: INVOLVE SPARSE CVXOPT MATRICES
p = QP(H = eye(n), f = -x, A = A, b=b, Aeq=Aeq, beq=beq, lb=lb, ub=ub)
r = p.solve('cvxopt_qp')
return r.xf
if __name__ == '__main__':
x = array((1, 2, 3))
lb, ub = None, None
A = [3, 4, 5]
b = -15
Aeq, beq = None, None
proj = pointProjection(x, lb, ub, A, b, Aeq, beq)
print(proj)
|