Accord.net Cobyla solver returns success when there are no feasiable solutions

不打扰是莪最后的温柔 提交于 2019-12-07 14:45:55

问题


I'm using Accord.Net's Cobyla solver to solve a rather simple non-linear problem. In some cases there will be no feasible points for the problem. When I run even a simple problem where the non-feasibility is obvious, the solver return "Success" even though 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 the solver is found is 4.5 which clearly violate the first and second constraints however the solver status is "successful".

Is that a bug/feature? Any workaround?


回答1:


I am the author of the C# COBYLA code that 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 original code.

The optimization method currently only supports three return statuses:

  • Normal termination
  • Maximum number of function evaluations reached
  • Rounding errors are increasing in an uncontrolled way

There exists no explicit indication saying that constraints are violated. COBYLA strives to meet the constraints, but is not guaranteed to succeed with this and may return without having fulfilled the constraints.

If I interpret your example correctly (my F# knowledge is a little rusty for the moment) you have two contradicting constraints, or? As a possible workaround, I would otherwise suggest that you select a variable start guess that at least approximately fulfills the constraints; that should make it easier for COBYLA to stay within the feasible region.



来源:https://stackoverflow.com/questions/30567946/accord-net-cobyla-solver-returns-success-when-there-are-no-feasiable-solutions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!