SCIP 中的常规函数​​是否可在 PySCIPOpt 中调用?

Are regular functions in SCIP callable in PySCIPOpt?

我目前正在 Linux 环境中使用 SCIP,并且随着我的研究逐渐转向机器学习,我想转向使用 PySCIPOpt。

我已阅读 Github 中的 PySCIPOpt 教程以及 S Maher 的文档,发现他们无法在我跳转之前回答我的问题。

SCIP 中的常规函数​​(例如 read (problem) 也可以在 PySCIPOpt 中使用吗?这是因为我有 mps 文件、pbo 文件,不想重写函数或 类 解析文件以使其符合 Maher 文档中的格式:

从 pyscipopt 导入模型 scip = 模型 ()

x = scip.addVar('x', vtype='C')

y = scip.addVar('y', vtype='I')

科学。设置目标 (x + y)

scip.addCons(2*x + y*y >= 10)

scip.optimize()

我想你的意思是你在交互式 shell 中使用的命令? (SCIP 中没有 read 函数)。 您可以在 PySCIPOpt 中使用的所有函数都包含在 PySCIPopt src 目录中的 scip.pyx 文件中。

所以你可以阅读 readProblem 的问题,它包装了 SCIP API 函数 SCIPreadProb

代码看起来像这样:

from pyscipopt import Model

model = Model()

model.readProblem('filename')

model.optimize()