Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I insert an Input Convex Nerual Network as an objective function into the cvxpylayer? #138

Open
lk1983823 opened this issue Jan 16, 2023 · 0 comments

Comments

@lk1983823
Copy link

The cvxpylayer uses the Cvxpy form of objective function as its objective in the problem, such as:

objective = cp.Minimize(0.5 * cp.pnorm(A @ x - b, p=1))
problem = cp.Problem(objective, constraints)
assert problem.is_dpp()
cvxpylayer = CvxpyLayer(problem, parameters=[A, b], variables=[x])
A_tch = torch.randn(m, n, requires_grad=True)
b_tch = torch.randn(m, requires_grad=True)

However, I want to use a more complicated convex objective to do the optimization. For example, a trained input convex neural network with pytorch code may be a suitable objective function. So how can I do this?
Thanks for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant