控制模型文件中的有效位数

时间:2019-04-15 02:58:06

标签: pyomo

Pyomo中是否有一种方法可以控制目标函数中有效位数的数量以及发送到求解器的约束矩阵系数?

在我的情况下,目标的形式和问题数据可从文件中获取或在程序中创建,然后顺序解决所产生的问题。结果,使用舍入功能或十进制程序包只能部分地控制有效数字的数量。理想情况下,Pyomo中的某些全局方法将能够控制最终模型中的有效位数,该最终模型会以LP文件的形式发送到求解器。

1 个答案:

答案 0 :(得分:0)

您正在使用哪个求解器。例如IP-OPT有许多设置。这两个可以帮助您:

tiny_step_tol                          0 <= (2.22045e-15) <  +inf      
   Tolerance for detecting numerically insignificant steps.
     If the search direction in the primal variables (x and s) is, in relative
     terms for each component, less than this value, the algorithm accepts the
     full step without line search.  If this happens repeatedly, the algorithm
     will terminate with a corresponding exit message. The default value is 10
     times machine precision.

tiny_step_y_tol                        0 <= (       0.01) <  +inf      
   Tolerance for quitting because of numerically insignificant steps.
     If the search direction in the primal variables (x and s) is, in relative
     terms for each component, repeatedly less than tiny_step_tol, and the
     step in the y variables is smaller than this threshold, the algorithm
     will terminate.

要使用它们,您需要在工作目录的ipopt.opt文件中设置它们的新值。

相关问题