如果没有可行的解决方案,则Accord.net Cobyla求解器将返回成功 [英] Accord.net Cobyla solver returns success when there are no feasiable solutions

查看:141
本文介绍了如果没有可行的解决方案,则Accord.net Cobyla求解器将返回成功的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Accord.Net的Cobyla求解器来解决一个非常简单的非线性问题。在某些情况下,没有可行的解决方案。
当我甚至运行一个简单的问题(其中不可行很明显)时,即使解决方案不可行,求解器也会返回成功。

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.

考虑一下下面的示例以F#编写:

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

找到的求解器为4.5,显然违反了第一和第二个约束,但是求解器的状态为成功。

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?

推荐答案

我是C#COBYLA代码的作者,该代码是 Accord.NET COBYLA版本。 C#实现是Michael Powell原始代码的FORTRAN 77的相当简单的翻译。

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:


  • 正常终止

  • 达到最大功能评估次数

  • 舍入误差在不断增加不受控制的方式

没有明确的迹象表明违反了约束。 COBYLA努力满足约束条件,但是并不能保证一定会成功,并且可能会在没有满足约束条件的情况下返回。

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.

如果我正确地解释了您的示例(我的F#知识是您现在有两个矛盾的约束,还是?作为一种可能的解决方法,否则我建议您选择一个至少近似满足约束条件的变量开始猜测。这应该使COBYLA能够更容易地停留在可行的区域内。

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.

这篇关于如果没有可行的解决方案,则Accord.net Cobyla求解器将返回成功的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆