2017-06-26 22 views
0

我在一個相當複雜的模型上使用Pyomo和Bonmin,它使用了12個多小時來計算。Pyomo Bonmin提前檢索結果

我試着將參數「bonmin.time_limit」設置爲1800(30分鐘),但它沒有返回任何變量值。

> ========================================================== 
> = Solver Results           = 
> ========================================================== 
> ---------------------------------------------------------- 
> Problem Information 
> ---------------------------------------------------------- 
> Problem: 
> - Lower bound: -inf 
> Upper bound: inf 
> Number of objectives: 1 
> Number of constraints: 0 
> Number of variables: 0 
> Sense: unknown 
> ---------------------------------------------------------- 
> Solver Information 
> ---------------------------------------------------------- 
Solver: 
> - Status: warning 
> Message: bonmin\x3a Optimization interupted on limit. 
> Termination condition: maxIterations 
> Id: 410 
> Error rc: 0 
> Time: 1813.3797194957733 
> ---------------------------------------------------------- 
> Solution Information 
> ---------------------------------------------------------- 
Solution: 
> - number of solutions: 0 
> number of solutions displayed: 0 

它輸出信息的多個「塊」。

有時,它輸出:

iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls 
600 -2.7877808e+005 1.82e-012 6.71e-003 -11.0 2.75e+000 -10.5 1.00e+000 5.56e-001h 1 
601 -2.7877808e+005 1.82e-012 6.79e-010 -11.0 1.05e+000 -10.0 1.00e+000 1.00e+000f 1 
Number of Iterations....: 601 
            (scaled)     (unscaled) 
Objective...............: -7.4080060189689470e+002 -2.7877808250893821e+005 
Dual infeasibility......: 6.7945537380025706e-010 2.5569264627135494e-007 
Constraint violation....: 1.8189894035458565e-012 1.8189894035458565e-012 
Complementarity.........: 8.6460028294267016e-011 3.2536637848060228e-008 
Overall NLP error.......: 6.7945537380025706e-010 2.5569264627135494e-007 

Number of objective function evaluations    = 1075 
Number of objective gradient evaluations    = 516 
Number of equality constraint evaluations   = 1075 
Number of inequality constraint evaluations   = 1075 
Number of equality constraint Jacobian evaluations = 604 
Number of inequality constraint Jacobian evaluations = 604 
Number of Lagrangian Hessian evaluations    = 601 
Total CPU secs in IPOPT (w/o function evaluations) = 101.103 
Total CPU secs in NLP function evaluations   =  0.694 

EXIT: Optimal Solution Found. 

但隨後,它會立即運行另一組計算(這繼續從以前的塊):

(Previous block) EXIT: Optimal Solution Found. 
This is Ipopt version 3.10.1, running with linear solver mumps. 

Number of nonzeros in equality constraint Jacobian...:  6670 
Number of nonzeros in inequality constraint Jacobian.: 13580 
Number of nonzeros in Lagrangian Hessian.............:  196 

Total number of variables............................:  3694 
        variables with only lower bounds:  2730 
       variables with lower and upper bounds:  964 
        variables with only upper bounds:  0 
Total number of equality constraints.................:  1238 
Total number of inequality constraints...............:  3612 
     inequality constraints with only lower bounds:  160 
    inequality constraints with lower and upper bounds:  0 
     inequality constraints with only upper bounds:  3452 

iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls 
    0 -2.7146106e+005 9.00e+000 1.66e+000 0.0 0.00e+000 - 0.00e+000 0.00e+000 0 
    1 -2.7135545e+005 9.00e+000 3.38e+000 4.8 3.59e+006 - 8.46e-008 2.71e-007f 1 
    2 -2.7112865e+005 9.00e+000 7.89e+000 4.7 3.14e+006 - 2.80e-007 6.37e-007f 1 
    3 -2.7083702e+005 9.00e+000 8.43e+000 4.2 8.99e+005 - 2.67e-006 2.79e-006f 1 

等等...

有沒有什麼辦法從第一塊獲得解決方案?

它只是永遠這樣重複。

+0

忽略問題信息部分(看起來很糟糕;錯誤解析?):也許bonmin沒有找到一個可行的解決方案?也許刪除一些約束來檢查更簡單的問題是否與早期停止一起工作(是的:在一些問題中這可能是不平凡的,因爲無界限可能成爲問題)。並且:你的問題凸起了嗎? – sascha

+0

在Bonmin運行時,您還可以使用tee = True或--stream-solver獲取求解器輸出信息。 –

+0

我會將輸出粘貼到新答案中,以便於查看 – japseow

回答

0

它輸出信息的多個「塊」。

有時,它輸出:

iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls 
600 -2.7877808e+005 1.82e-012 6.71e-003 -11.0 2.75e+000 -10.5 1.00e+000 5.56e-001h 1 
601 -2.7877808e+005 1.82e-012 6.79e-010 -11.0 1.05e+000 -10.0 1.00e+000 1.00e+000f 1 
Number of Iterations....: 601 
            (scaled)     (unscaled) 
Objective...............: -7.4080060189689470e+002 -2.7877808250893821e+005 
Dual infeasibility......: 6.7945537380025706e-010 2.5569264627135494e-007 
Constraint violation....: 1.8189894035458565e-012 1.8189894035458565e-012 
Complementarity.........: 8.6460028294267016e-011 3.2536637848060228e-008 
Overall NLP error.......: 6.7945537380025706e-010 2.5569264627135494e-007 

Number of objective function evaluations    = 1075 
Number of objective gradient evaluations    = 516 
Number of equality constraint evaluations   = 1075 
Number of inequality constraint evaluations   = 1075 
Number of equality constraint Jacobian evaluations = 604 
Number of inequality constraint Jacobian evaluations = 604 
Number of Lagrangian Hessian evaluations    = 601 
Total CPU secs in IPOPT (w/o function evaluations) = 101.103 
Total CPU secs in NLP function evaluations   =  0.694 

EXIT: Optimal Solution Found. 

但隨後,它會立即運行另一組計算(這繼續從以前的塊):

(Previous block) EXIT: Optimal Solution Found. 
This is Ipopt version 3.10.1, running with linear solver mumps. 

Number of nonzeros in equality constraint Jacobian...:  6670 
Number of nonzeros in inequality constraint Jacobian.: 13580 
Number of nonzeros in Lagrangian Hessian.............:  196 

Total number of variables............................:  3694 
        variables with only lower bounds:  2730 
       variables with lower and upper bounds:  964 
        variables with only upper bounds:  0 
Total number of equality constraints.................:  1238 
Total number of inequality constraints...............:  3612 
     inequality constraints with only lower bounds:  160 
    inequality constraints with lower and upper bounds:  0 
     inequality constraints with only upper bounds:  3452 

iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls 
    0 -2.7146106e+005 9.00e+000 1.66e+000 0.0 0.00e+000 - 0.00e+000 0.00e+000 0 
    1 -2.7135545e+005 9.00e+000 3.38e+000 4.8 3.59e+006 - 8.46e-008 2.71e-007f 1 
    2 -2.7112865e+005 9.00e+000 7.89e+000 4.7 3.14e+006 - 2.80e-007 6.37e-007f 1 
    3 -2.7083702e+005 9.00e+000 8.43e+000 4.2 8.99e+005 - 2.67e-006 2.79e-006f 1 

等等...

有沒有什麼辦法從第一塊獲得解決方案?

它只是永遠這樣重複。

+0

將來,請使用其他信息更新您的原始問題,並且不要將其他信息作爲「答案」發佈。這些輸出塊來自NLP子問題解決方案(在本例中爲'ipopt'),並且不符合MINLP的實際現有(整數可行)解決方案。因此,邦明不會報告這些解決方案。 – jsiirola

+0

我明白了。是否有任何參數可以使我快速獲得大致的答案? – japseow

+0

您可以查看bonmin選項:https://www.coin-or.org/Bonmin/option_pages/options_list_bonmin.html。我不知道Pyomo中有什麼能夠給你想要的東西。 –