【问题标题】:SCIP: Solving QPs via interactive shellSCIP:通过交互式 shell 解决 QP
【发布时间】:2016-08-05 13:17:45
【问题描述】:

是否可以通过预编译的二进制文件(交互式 shell)求解 QP?

我尝试了几个示例,但没有一个有效。我错过了什么吗?

Minimize
obj: a + b + [ a^2 + 4 a * b + 7 b^2 ]
Subject To
c1: a + b >= 10
End

在这个我得到以下消息:

[src/scip/reader_lp.c:147] ERROR: Syntax error in line 3 ('Subject'): expected '/2' or '/ 2' after end of quadratic part in objective. 
  input: Subject To
               ^
[src/scip/reader_lp.c:3362] ERROR: Error <-2> in function cal

另一个例子:

Maximize
 obj: x1 + 2 x2 + 3 x3 + x4
Subject To
 c1: - x1 * x3 + x2 + x3 + 10 x4 <= 20
 c2: x1 - 3 x2 + x3 <= 30
 c3: x2 - 3.5 x4 = 0
Bounds
 0 <= x1 <= 40
 2 <= x4 <= 3
General
 x4
End

这里是输出消息:

[src/scip/reader_lp.c:147] ERROR: Syntax error in line 4 ('x3'): expected sign ('+' or '-') or sense ('<' or '>'). 
  input:  c1: - x1  x3 + x2 + x3 + 10 x4 <= 20
                       ^
[src/scip/reader_lp.c:3362] ERROR: Error <-2> in function call
error reading file <sample.lp>

【问题讨论】:

    标签: scip


    【解决方案1】:

    也许可以试试 .pip 格式 (http://polip.zib.de/pipformat.php)。这类似于 .lp,但在指定二次方时不那么尴尬。

    【讨论】:

      【解决方案2】:

      固定的第一个例子是

      Minimize
      obj: a + b + [ 2 a^2 + 8 a * b + 14 b^2 ] / 2
      Subject To
      c1: a + b >= 10
      End
      

      固定的第二个例子是

      Maximize
      obj: x1 + 2 x2 + 3 x3 + x4
      Subject To
      c1: x2 + x3 + 10 x4 + [ - x1 * x3 ] + <= 20
      c2: x1 - 3 x2 + x3 <= 30
      c3: x2 - 3.5 x4 = 0
      Bounds
      0 <= x1 <= 40
      2 <= x4 <= 3
      General
      x4
      End
      

      还要查看 CPLEX 手册中有关 .lp 文件格式的规范。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-10-30
        • 1970-01-01
        • 2013-05-06
        • 2015-11-01
        • 2013-04-16
        • 2023-04-04
        • 1970-01-01
        相关资源
        最近更新 更多