Closed zaikunzhang closed 8 months ago
optional options could be passed via a pointer to a struct:
prima_options opt;
prima_init_options(&opt);
opt.nlconstr0 = ...
opt.f0 = ...
opt.eta1 = ...
prima_cobyla(..., &opt) // with options
prima_cobyla(..., NULL) // without options
See the discussion at
https://github.com/libprima/PRIMA.jl/issues/14#issuecomment-1770266055
for the reason.
Since C does not support optional inputs (unfortunately), let us do the following:
nlconstr0
, then it should be set toNULL
;f0
, then it should be set toNaN
;cobyla_c.f90
, check the values ofnlconstr0
andf0
to decide whether to callcobyla
withnlconstr0
&f0
or without them (they are optional inputs tocobyla
);cobyla_c.f90
, check the values ofnlconstr0
andf0
. Ifnlconstr0
isNULL
off0
isNaN
, then callcalcfc
to evaluate them; afterwards, callcobyla
withnlconstr0
andf0
.Thanks.