locuslab / optnet

OptNet: Differentiable Optimization as a Layer in Neural Networks
Apache License 2.0
511 stars 75 forks source link

QP Solver with extra terms and more variables #6

Closed Benjiou closed 5 years ago

Benjiou commented 5 years ago

Hi @bamos ,

Thank you for this promising work and clean code if you don't mind.

I have some questions related to the solver.

Is it possible to :

1) Add extra terms in the objective function and variable constraints ? https://github.com/locuslab/qpth/blob/master/qpth/qp.py#L36

A) extra terms in the objective function

\hat z = argmin_z 1/2 z^T Q z + p^T z+......+....+......

B) Add more variables constraints : for instance add y_, F_, K_, n_ to Q_, p_, G_, h_, A_, b_

2) Is this constraint solver can deal with maximum solution rather than minimum ?

\hat z = argmax_z 1/2 z^T Q z + p^T z+......+....+......

Thank you a lot for your answer

bamos commented 5 years ago

Hi @Benjiou - just a quick response here, let me know if there's anything else!

1) if extra terms in the objective still make your problem a QP it's probably the easiest (although not necessarily the most efficient) to re-formulate your problem so that it's in standard form. It may be more efficient to implement a solver for your problem

2) You should be able to do this with \hat z = argmax f(z) = argmin -f(z)