-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from chrhansk/feature-qp-tests
Add QP test instances
- Loading branch information
Showing
10 changed files
with
255 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "pygradflow" | ||
version = "0.5.18" | ||
version = "0.5.19" | ||
description = "PyGradFlow is a simple implementation of the sequential homotopy method to be used to solve general nonlinear programs." | ||
authors = ["Christoph Hansknecht <[email protected]>"] | ||
readme = "README.md" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from pygradflow.problem import Problem | ||
|
||
|
||
class QP(Problem): | ||
def __init__(self, hess, jac, grad, res, lb, ub): | ||
self.m, self.n = jac.shape | ||
assert hess.shape[0] == self.n | ||
assert hess.shape[1] == self.n | ||
assert grad.shape[0] == self.n | ||
assert res.shape[0] == self.m | ||
super().__init__(lb, ub, num_cons=self.m) | ||
self.A = hess | ||
self.B = jac | ||
self.a = grad | ||
self.b = res | ||
|
||
def obj(self, x): | ||
return 0.5 * x.T @ self.A @ x + self.a.T @ x | ||
|
||
def obj_grad(self, x): | ||
return self.A @ x + self.a | ||
|
||
def cons(self, x): | ||
return self.B @ x + self.b | ||
|
||
def cons_jac(self, x): | ||
return self.B | ||
|
||
def lag_hess(self, x, _): | ||
return self.A |
Oops, something went wrong.