【问题标题】:Get infeasibilities with IBM cplex feasopt python's interface使用 IBM cplex feasopt python 的接口获取不可行性
【发布时间】:2019-06-26 14:46:24
【问题描述】:

我正在使用 IBM CPLEX python 的 API 来求解线性程序。

我正在求解的线性程序被证明是不可行的,所以我使用 CPLEX 的 feasopt() 来缓解这个问题。

我可以通过my_prob.feasopt(my_prob.feasopt.all_constraints())得到一个可行的解决方案,其中 feasopt 放宽了所有的限制。

但我有兴趣获得每个约束的松弛量。特别是,在文档中它说In addition to that conventional solution vector, FeasOpt also produces a vector of values that provide useful information about infeasible constraints and variables.

我有兴趣得到这个向量。

【问题讨论】:

  • 这个问题是在 IBM developerWorks 论坛 here 上交叉发布的。我也在那里回答。

标签: optimization linear-programming cplex


【解决方案1】:

相信你正在寻找Cplex.solution.infeasibility接口下可用的方法。

示例用法:

# query the infeasibilities for all linear constraints
rowinfeas = my_prob.solution.infeasibility.linear_constraints(
    my_prob.solution.get_values())

【讨论】:

  • 谢谢,为交叉发帖道歉。
猜你喜欢
  • 1970-01-01
  • 2020-10-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-08-10
相关资源
最近更新 更多