简体   繁体   English

是否可以直接从 PyScipOpt 模型对象访问 SCIP 的统计输出值?

[英]Is it possible to access SCIP's Statistics output values directly from PyScipOpt Model Object?

I'm using SCIP to solve MILPs in Python using PyScipOpt.我正在使用 SCIP 使用 PyScipOpt 在 Python 中解决 MILP。 After solving a problem, the solver statistics can be either 1) printed as a string using printStatistics() , or 2) saved to an external file using writeStatistics() .解决问题后,求解器统计信息可以是 1) 使用printStatistics()打印为字符串,或 2) 使用writeStatistics()保存到外部文件。 For example:例如:

import pyscipopt as pso
model = pso.Model()
model.addVar(name="x", obj=1)
model.optimize()
model.printStatistics()
model.writeStatistics(filename="stats.txt")

There's a lot of information in printStatistics / writeStatistics that doesn't seem to be accessible from the Python model object directly (eg primal-dual integral value, data for individual branching rules or primal heuristics, etc.) It would be helpful to be able to extract the data from this output via, eg, attributes of the model object or a dictionary. printStatistics / writeStatistics中有很多信息似乎无法直接从 Python model对象访问(例如原始对偶整数值、单个分支规则的数据或原始启发式算法等)。通过例如model对象或字典的属性从该输出中提取数据。

Is there any way to access this information from the model object without having to parse the raw text/file output?有没有办法从model对象访问这些信息而不必解析原始文本/文件输出?

PySCIPOpt does not provide access to the statistics directly. PySCIPOpt 不直接提供对统计信息的访问。 The data for the various tables (eg separators, presolvers, etc.) are stored separately for every single plugin in SCIP and are sometimes not straightforward to collect.各种表(例如分隔符、预求解器等)的数据针对 SCIP 中的每个插件单独存储,有时收集起来并不简单。 If you are only interested in certain statistics about the general solving process, then you might want to add PySCIPOpt wrappers for a few of the simple get functions defined in scip_solvingstats.c .如果你只在对一般的解决过程中,某些统计数据感兴趣的话,那么你可能要添加PySCIPOpt包装几个简单get中定义的函数scip_solvingstats.c

Lastly, you might want to check out IPET for parsing the statistics output.最后,您可能想查看IPET来解析统计输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM