Accord.net Cobyla solver returns success when no solutions available

I am using Accord.Net Cobyla solver to solve a fairly simple non-linear problem. In some cases, there will be no possible points for this problem. When I run even a simple problem where the impracticability is obvious, the solver returns "Success", although the solution is not feasible.

Consider the 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 found by the solver is 4.5, which clearly violates the first and second constraints, but the solver status is "successful".

Is this a bug / feature? Any workaround?

+3


source to share


1 answer


I am the author of the C # COBYLA code which is the basis for the Accord.NET version of COBYLA. The C # implementation is a fairly straightforward translation from FORTRAN 77 of Michael Powell's source code.

The optimization method currently only supports three return states:

  • Normal completion
  • Maximum number of feature evaluations reached
  • Rounding errors grow in an uncontrollable way


There is no explicit indication that the restrictions are being violated. COBYLA seeks to satisfy the restrictions, but it is not guaranteed that it will succeed and can return without meeting the restrictions.

If I am interpreting your example correctly (I have a little rusty knowledge at the moment) do you have two conflicting constraints or? As a possible workaround, I would suggest that you choose the start guess variable that at least roughly satisfies the constraints; which should make it easier for COBYLA to stay within the valid region.

+1


source







All Articles