computation of the value and the gradient of the objective function.
Note
This routine was formerly called pf1f01.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(psqp_class), | intent(inout) | :: | me | |||
| integer, | intent(in) | :: | nf |
number of variables. |
||
| real(kind=wp), | intent(in) | :: | x(nf) |
x(nf) vector of variables. |
||
| real(kind=wp), | intent(out) | :: | gf(nf) |
gf(nf) gradient of the model function. |
||
| real(kind=wp), | intent(out) | :: | g(nf) |
g(nf) gradient of the objective function. |
||
| real(kind=wp), | intent(out) | :: | ff |
value of the model function. |
||
| real(kind=wp), | intent(out) | :: | f |
value of the objective function. |
||
| integer, | intent(in) | :: | kd |
degree of required derivatives. |
||
| integer, | intent(inout) | :: | ld |
degree of previously computed derivatives. |
||
| integer, | intent(in) | :: | iext |
type of extremum.
|
subroutine compute_obj_and_dobj(me, nf, x, gf, g, ff, f, kd, ld, iext) class(psqp_class), intent(inout) :: me integer,intent(in) :: nf !! number of variables. real(wp),intent(in) :: x(nf) !! x(nf) vector of variables. real(wp),intent(out) :: gf(nf) !! gf(nf) gradient of the model function. real(wp),intent(out) :: g(nf) !! g(nf) gradient of the objective function. real(wp),intent(out) :: ff !! value of the model function. real(wp),intent(out) :: f !! value of the objective function. integer,intent(in) :: kd !! degree of required derivatives. integer,intent(inout) :: ld !! degree of previously computed derivatives. integer,intent(in) :: iext !! type of extremum. !! !! * `iext=0` -- minimum. !! * `iext=1` -- maximum. if (kd <= ld) return if (ld < 0) then me%nfv = me%nfv + 1 call me%obj(nf, x, ff) if (iext <= 0) then f = ff else f = -ff end if end if if (kd >= 1) then if (ld < 1) then me%nfg = me%nfg + 1 call me%dobj(nf, x, gf) if (iext > 0) call mxvneg(nf, gf, g) end if end if ld = kd end subroutine compute_obj_and_dobj