简体   繁体   English

Pyomo-Solver通讯

[英]Pyomo-Solver Communication

I was wondering what information is passed by the pyomo script to the solver (eg Cbc). 我想知道pyomo脚本将哪些信息传递给求解器(例如Cbc)。 In specific, I want to ask whether, whatever constraints and objective function I code, does the solver ask python to do the computation of these functions or are they done in the language the solver is written. 具体来说,我想问的是,无论我编写的约束和目标函数是什么,求解器是否要求python进行这些函数的计算,或者它们是以求解器编写的语言完成的。

Computations are done in the language the solver is written in. In most cases Pyomo takes your model and will output it to a file using the .lp or .nl format for linear and nonlinear models respectively. 计算是使用求解器编写的语言完成的。在大多数情况下,Pyomo会获取您的模型,并将其分别使用.lp.nl格式输出到线性和非线性模型中的文件。 The solver will read the file, create its own representation of the model, solve the problem, and write a .sol file with the solution. 求解器将读取文件,创建自己的模型表示形式,解决问题,并使用解决方案编写一个.sol文件。 Pyomo will then read the .sol file and load the solution back into the Pyomo model in Python. 然后,Pyomo将读取.sol文件,并将解决方案重新加载到Python中的Pyomo模型中。 The one exception to this workflow is if you're using the direct or persistent interface to Gurobi. 此工作流程的一个例外是,如果您使用的是Gurobi的直接或持久接口。 In that case no files are written but I believe all the computations are still done in the language of the solver. 在那种情况下,没有文件被写入,但是我相信所有计算仍以求解器的语言完成。

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

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