Skip to content

Commit 734bd93

Browse files
committed
Also add a flag for the gradient
1 parent 4b6d2bb commit 734bd93

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

docs/src/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,12 @@ Attribute | Type | Notes
113113
`minimize` | `Bool` | true if `optimize == minimize`
114114
`islp` | `Bool` | true if the problem is a linear program
115115
`name` | `String` | problem name
116+
`gradient_available` | `Bool` | true if the gradient of the objective is available
116117
`jacobian_available` | `Bool` | true if the sparse Jacobian of the constraints is available
117118
`hessian_available` | `Bool` | true if the sparse Hessian of the Lagrangian is available
118119
`Jv_available` | `Bool` | true if the Jacobian-vector product `J * v` is available
119120
`Jtv_available` | `Bool` | true if the transpose Jacobian-vector product `J' * v` is available
120-
`Hv_available` | `Bool` | true if the Hessian-vector product of the objective or Lagrangian `H * v` is available
121+
`Hv_available` | `Bool` | true if the Hessian-vector product of the Lagrangian `H * v` is available
121122

122123
## License
123124

src/nlp/meta.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ The following keyword arguments are accepted:
5151
- `minimize`: true if optimize == minimize
5252
- `islp`: true if the problem is a linear program
5353
- `name`: problem name
54+
- `gradient_available`: indicates whether the gradient of the objective is available
5455
- `jacobian_available`: indicates whether the sparse Jacobian of the constraints is available
5556
- `hessian_available`: indicates whether the sparse Hessian of the Lagrangian is available
5657
- `Jv_available`: indicates whether the Jacobian-vector product `J * v` is available
5758
- `Jtv_available`: indicates whether the transpose Jacobian-vector product `J' * v` is available
58-
- `Hv_available`: indicates whether the Hessian-vector product of the objective or Lagrangian `H * v` is available
59+
- `Hv_available`: indicates whether the Hessian-vector product of the Lagrangian `H * v` is available
5960
6061
`NLPModelMeta` also contains the following attributes, which are computed from the variables above:
6162
- `nvar`: number of variables
@@ -120,6 +121,7 @@ struct NLPModelMeta{T, S} <: AbstractNLPModelMeta{T, S}
120121
islp::Bool
121122
name::String
122123

124+
gradient_available::Bool
123125
jacobian_available::Bool
124126
hessian_available::Bool
125127
Jv_available::Bool
@@ -148,6 +150,7 @@ function NLPModelMeta{T, S}(
148150
minimize::Bool = true,
149151
islp::Bool = false,
150152
name = "Generic",
153+
gradient_available::Bool = true,
151154
jacobian_available::Bool = true,
152155
hessian_available::Bool = true,
153156
Jv_available::Bool = true,
@@ -229,6 +232,7 @@ function NLPModelMeta{T, S}(
229232
minimize,
230233
islp,
231234
name,
235+
gradient_available,
232236
jacobian_available,
233237
hessian_available,
234238
Jv_available,
@@ -262,6 +266,7 @@ function NLPModelMeta(
262266
minimize::Bool = meta.minimize,
263267
islp::Bool = meta.islp,
264268
name = meta.name,
269+
gradient_available::Bool = meta.gradient_available,
265270
jacobian_available::Bool = meta.jacobian_available,
266271
hessian_available::Bool = meta.hessian_available,
267272
Jv_available::Bool = meta.Jv_available,
@@ -289,6 +294,7 @@ function NLPModelMeta(
289294
minimize = minimize,
290295
islp = islp,
291296
name = name,
297+
gradient_available = gradient_available,
292298
jacobian_available = jacobian_available,
293299
hessian_available = hessian_available,
294300
Jv_available = Jv_available,

0 commit comments

Comments
 (0)