f# - Accord.net Cobyla solver returns success when there are no feasiable solutions -
i'm using accord.net's cobyla solver solve rather simple non-linear problem. in cases there no feasible points problem. when run simple problem non-feasibility obvious, solver return "success" though solution not feasible.
consider following example, written in f#:
open system.collection.generics let obj12 = quadraticobjectivefunction("a - a*a"); let c12 = quadraticconstraint(obj12, array2d.zerocreate 1 1, [| 10.0 |], constrainttype.lesserthanorequalto, 4.0) let c13 = quadraticconstraint(obj12, array2d.zerocreate 1 1, [| 10.0 |], constrainttype.greaterthanorequalto, 45.0) let p1 = list<nonlinearconstraint>() p1.add(c12) p1.add(c13) let solver1 = cobyla(obj12, p1) let success = solver1.maximize() let value = solver1.value let solution = solver1.solution let r = solver1.status
the solution solver found 4.5 violate first , second constraints solver status "successful".
is bug/feature? workaround?
i author of c# cobyla code basis accord.net version of cobyla. c# implementation straightforward translation fortran 77 of michael powell's original code.
the optimization method supports 3 return statuses:
- normal termination
- maximum number of function evaluations reached
- rounding errors increasing in uncontrolled way
there exists no explicit indication saying constraints violated. cobyla strives meet constraints, not guaranteed succeed , may return without having fulfilled constraints.
if interpret example correctly (my f# knowledge little rusty moment) have 2 contradicting constraints, or? possible workaround, otherwise suggest select variable start guess @ least approximately fulfills constraints; should make easier cobyla stay within feasible region.
Comments
Post a Comment