给出结果作为模型的初始但解决恢复

时间:2018-11-27 13:59:28

标签: python pyomo ipopt

嗨,我用pyomo建立了一个DAEs模型,并用ipopt解决了这个问题。

但是,我发现了这些问题。

  1. 模型可以求解到可接受的水平,但是当我改变nfe的数量或有限元素的长度时,它无法求解,并且我得到了“恢复阶段收敛到具有很小的原始不可行性的点”。

  2. 我猜可能是由varible的初始值引起的。因此,我尝试从求解器获取模型的结果,并将其作为新的初始值提供给模型,但失败了。

我在一个简单的示例(car_example)中得到了它,迭代次数减少了。

那么,为什么它在大型模型中会失败?

非常感谢

    D:\python\python.exe E:/Yan/4Keyan/1HTRmodel/PYOMO/H_sml1114/HTR_run.py
Ipopt 3.8.1: linear_solver=ma57
max_iter=100


******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
 Ipopt is released as open source code under the Common Public License (CPL).
         For more information visit http://projects.coin-or.org/Ipopt
******************************************************************************

NOTE: You are using Ipopt by default with the MUMPS linear solver.
      Other linear solvers might be more efficient (see Ipopt documentation).


This is Ipopt version 3.8.1, running with linear solver ma57.

Number of nonzeros in equality constraint Jacobian...:   103614
Number of nonzeros in inequality constraint Jacobian.:      120
Number of nonzeros in Lagrangian Hessian.............:    57810

Total number of variables............................:    31800
                     variables with only lower bounds:     5100
                variables with lower and upper bounds:    23400
                     variables with only upper bounds:        0
Total number of equality constraints.................:    31800
Total number of inequality constraints...............:       62
        inequality constraints with only lower bounds:       62
   inequality constraints with lower and upper bounds:        0
        inequality constraints with only upper bounds:        0

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0 1.0000000e+000 1.49e+004 1.00e+000  -1.0 0.00e+000    -  0.00e+000 0.00e+000   0
   1 1.0000000e+000 1.06e+003 6.25e+011  -1.0 8.68e+006    -  6.86e-005 9.92e-001f  1
   2 1.0000000e+000 1.05e+003 6.23e+011  -1.0 1.12e+008    -  1.57e-002 3.17e-003h  5
   3 1.0000000e+000 1.05e+003 6.21e+011  -1.0 9.69e+007    -  2.01e-002 3.70e-003h  5
   4 1.0000000e+000 1.06e+003 6.16e+011  -1.0 8.31e+007    -  3.05e-002 8.25e-003h  4
   5 1.0000000e+000 1.06e+003 6.10e+011  -1.0 6.08e+007    -  3.85e-002 9.55e-003h  4
   6 1.0000000e+000 1.06e+003 5.97e+011  -1.0 4.46e+007    -  5.25e-002 2.20e-002h  3
   7 1.0000000e+000 1.08e+003 5.64e+011  -1.0 2.42e+007    -  7.27e-002 5.57e-002h  2
   8 1.0000000e+000 1.06e+003 4.74e+011  -1.0 1.04e+007    -  2.64e-001 1.60e-001h  1
   9 1.0000000e+000 5.34e+002 8.69e+011  -1.0 4.91e+006    -  9.93e-003 1.00e+000h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  10 1.0000000e+000 5.04e+001 1.22e+008  -1.0 1.52e+006    -  3.46e-001 1.00e+000h  1
  11 1.0000000e+000 7.80e-002 5.31e+006  -1.0 1.94e+005    -  9.13e-001 1.00e+000h  1
  12 1.0000000e+000 1.81e-007 7.24e+003  -1.0 2.07e+003    -  9.90e-001 1.00e+000h  1
  13 1.0000000e+000 1.68e-007 3.00e-002  -1.0 8.66e-002    -  9.90e-001 1.00e+000h  1
  14 1.0000000e+000 2.61e-007 2.99e-004  -1.0 1.02e-005    -  9.90e-001 1.00e+000h  1
  15 1.0000000e+000 2.19e-007 2.09e-006  -1.0 2.06e-005    -  9.93e-001 1.00e+000h  1
  16 1.0000000e+000 2.62e-007 2.10e-007  -1.7 4.16e-005    -  1.00e+000 1.00e+000h  1
  17 1.0000000e+000 2.20e-007 1.13e-008  -3.8 8.50e-005    -  1.00e+000 1.00e+000h  1
  18 1.0000000e+000 1.81e-007 2.96e-009  -5.7 1.78e-004    -  1.00e+000 1.00e+000h  1
  19 1.0000000e+000 2.01e-007 2.08e-011  -8.6 3.88e-004    -  1.00e+000 1.00e+000s 22

Number of Iterations....: 19

                                   (scaled)                 (unscaled)
Objective...............:  1.0000000000000000e+000   1.0000000000000000e+000
Dual infeasibility......:  0.0000000000000000e+000   0.0000000000000000e+000
Constraint violation....:  2.0069879269613011e-007   4.7683715820312500e-007
Complementarity.........:  0.0000000000000000e+000   0.0000000000000000e+000
Overall NLP error.......:  2.0069879269613011e-007   4.7683715820312500e-007


Number of objective function evaluations             = 66
Number of objective gradient evaluations             = 21
Number of equality constraint evaluations            = 66
Number of inequality constraint evaluations          = 66
Number of equality constraint Jacobian evaluations   = 21
Number of inequality constraint Jacobian evaluations = 21
Number of Lagrangian Hessian evaluations             = 20
Total CPU secs in IPOPT (w/o function evaluations)   =     10.373
Total CPU secs in NLP function evaluations           =      5.245

EXIT: Solved To Acceptable Level.
Ipopt 3.8.1: linear_solver=ma57
max_iter=100


******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
 Ipopt is released as open source code under the Common Public License (CPL).
         For more information visit http://projects.coin-or.org/Ipopt
******************************************************************************

NOTE: You are using Ipopt by default with the MUMPS linear solver.
      Other linear solvers might be more efficient (see Ipopt documentation).


This is Ipopt version 3.8.1, running with linear solver ma57.

Number of nonzeros in equality constraint Jacobian...:   103614
Number of nonzeros in inequality constraint Jacobian.:      120
Number of nonzeros in Lagrangian Hessian.............:    57810

Total number of variables............................:    31800
                     variables with only lower bounds:     5100
                variables with lower and upper bounds:    23400
                     variables with only upper bounds:        0
Total number of equality constraints.................:    31800
Total number of inequality constraints...............:       62
        inequality constraints with only lower bounds:       62
   inequality constraints with lower and upper bounds:        0
        inequality constraints with only upper bounds:        0

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0 1.0000000e+000 4.61e-001 1.00e+000  -1.0 0.00e+000    -  0.00e+000 0.00e+000   0
   1 1.0000000e+000 1.06e+003 2.38e+010  -1.0 8.65e+006    -  7.93e-001 9.92e-001f  1
   2 1.0000000e+000 3.89e+003 2.12e+010  -1.0 1.01e+008    -  2.88e-002 2.88e-002s 18
   3 1.0000000e+000 3.68e+003 1.80e+010  -1.0 3.26e+007    -  5.55e-002 5.55e-002s 18
   4 1.0000000e+000 3.46e+003 1.62e+010  -1.0 1.16e+007    -  6.04e-002 6.04e-002s 18
   5 1.0000000e+000 3.45e+003 1.62e+010  -1.0 7.01e+006    -  2.12e-003 2.12e-003s 18
   6r1.0000000e+000 3.45e+003 9.99e+002   3.5 0.00e+000    -  0.00e+000 0.00e+000R  1
   7r1.0000000e+000 3.43e+003 2.20e+005   3.5 4.05e+005    -  1.45e-002 3.96e-004f  1
   8r1.0000000e+000 4.25e+003 5.65e+006   3.5 1.44e+005    -  1.45e-001 3.95e-003f  3
   9r1.0000000e+000 3.20e+003 3.98e+006   3.5 2.38e+000   4.0 9.90e-001 3.54e-001f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  10r1.0000000e+000 3.20e+003 1.44e+006   2.8 4.11e-001   3.5 8.25e-001 1.00e+000f  1
  11r1.0000000e+000 3.20e+003 4.66e+005   2.8 1.29e+000   3.0 9.91e-001 1.00e+000f  1
  12r1.0000000e+000 3.20e+003 1.44e+005   2.8 2.78e+000   2.6 8.16e-001 8.51e-001f  1
  13r1.0000000e+000 3.20e+003 5.24e+004   2.1 1.17e+000   3.0 9.97e-001 1.00e+000f  1
  14r1.0000000e+000 3.20e+003 1.89e+004   2.1 3.80e-001   3.4 1.00e+000 1.00e+000f  1
  15r1.0000000e+000 3.20e+003 8.86e+003   2.1 1.14e+000   2.9 1.00e+000 7.27e-001f  1
  16r1.0000000e+000 3.20e+003 1.77e+004   1.4 3.41e+000   2.5 5.65e-001 2.53e-001f  1
  17r1.0000000e+000 3.20e+003 5.68e+003   1.4 1.28e+000   2.9 6.15e-001 6.57e-001f  1
  18r1.0000000e+000 3.20e+003 4.48e+003   1.4 5.12e-002   5.1 9.80e-001 1.00e+000f  1
  19r1.0000000e+000 3.20e+003 9.99e+002   1.4 2.25e-002   4.6 1.00e+000 1.00e+000f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  20r1.0000000e+000 3.20e+003 1.00e+003   0.7 6.75e-002   4.2 9.96e-001 9.85e-001f  1
  21r1.0000000e+000 3.20e+003 1.29e+003   0.7 4.13e-002   4.6 1.00e+000 1.00e+000f  1
  22r1.0000000e+000 3.20e+003 1.04e+005   0.7 7.60e-002   4.1 1.00e+000 8.09e-001f  1
  23r1.0000000e+000 3.20e+003 6.02e+004   0.7 1.18e-002   5.4 1.00e+000 1.00e+000f  1
  24r1.0000000e+000 3.20e+003 2.16e+004   0.7 1.07e-002   5.0 1.00e+000 1.00e+000f  1
  25r1.0000000e+000 3.20e+003 1.92e+005   0.7 3.21e-002   4.5 1.00e+000 1.00e+000f  1
  26r1.0000000e+000 3.20e+003 4.71e+004   0.7 9.62e-002   4.0 1.00e+000 5.73e-001f  1
  27r1.0000000e+000 3.20e+003 1.72e+004   0.7 2.89e-001   3.5 7.97e-001 4.16e-001f  1
  28r1.0000000e+000 3.20e+003 3.77e+004   0.7 8.66e-001   3.1 5.31e-001 2.28e-001f  1
  29r1.0000000e+000 3.20e+003 2.36e+004   0.7 2.60e+000   2.6 6.76e-001 1.52e-001f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  30r1.0000000e+000 3.20e+003 2.85e+004   0.7 9.74e-001   3.0 1.00e+000 2.78e-001f  1
  31r1.0000000e+000 3.20e+003 4.13e+004   0.7 2.92e+000   2.5 4.21e-001 1.95e-001f  1
  32r1.0000000e+000 3.20e+003 4.73e+004   0.7 1.10e+000   3.0 1.00e+000 1.30e-001f  1
  33r1.0000000e+000 3.20e+003 1.15e+004   0.7 4.11e-001   3.4 1.00e+000 6.13e-001f  1
  34r1.0000000e+000 3.20e+003 2.25e+004   0.7 1.38e+000   2.9 2.89e-001 1.01e-001f  1
  35r1.0000000e+000 3.20e+003 2.34e+004   0.7 4.62e-001   3.3 1.00e+000 3.10e-001f  1
  36r1.0000000e+000 3.20e+003 5.55e+004   0.7 1.39e+000   2.9 8.19e-001 1.10e-001f  1
  37r1.0000000e+000 3.20e+003 8.08e+004   0.7 4.16e+000   2.4 1.00e+000 1.66e-002f  1
  38r1.0000000e+000 3.19e+003 6.29e+004   0.7 1.25e+001   1.9 5.59e-001 2.31e-001f  1
  39r1.0000000e+000 3.19e+003 1.04e+005   0.7 4.68e+000   2.3 9.06e-001 4.07e-001f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  40r1.0000000e+000 3.19e+003 9.88e+003   0.7 2.74e-002   4.6 1.00e+000 1.00e+000f  1
  41r1.0000000e+000 3.19e+003 9.99e+002   0.7 8.22e-002   4.1 1.00e+000 1.00e+000f  1
  42r1.0000000e+000 3.19e+003 2.32e+003   0.7 2.47e-001   3.6 1.00e+000 7.78e-001f  1
  43r1.0000000e+000 3.19e+003 2.67e+003   0.7 7.40e-001   3.1 1.00e+000 1.00e+000f  1
  44r1.0000000e+000 3.19e+003 9.99e+002   0.7 3.47e-002   4.5 1.00e+000 1.00e+000f  1
  45r1.0000000e+000 3.19e+003 9.99e+002   0.7 1.04e-001   4.0 1.00e+000 1.00e+000f  1
  46r1.0000000e+000 3.19e+003 9.99e+002   0.7 3.90e-002   4.4 1.00e+000 1.00e+000f  1
  47r1.0000000e+000 3.19e+003 5.75e+005   0.7 3.73e-001   3.9 1.72e-001 2.14e-001f  1
  48r1.0000000e+000 3.19e+003 3.62e+005   0.7 5.99e-002   4.4 5.89e-001 1.00e+000f  1
  49r1.0000000e+000 3.19e+003 2.62e+005   0.7 1.64e-001   3.9 3.15e-001 6.86e-001f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  50r1.0000000e+000 3.19e+003 2.46e+005   0.7 6.78e-001   3.4 1.10e-001 7.88e-002f  1
  51r1.0000000e+000 3.19e+003 1.93e+005   0.7 1.95e-001   3.8 7.28e-001 3.47e-001f  1
  52r1.0000000e+000 3.19e+003 1.05e+005   0.7 8.01e-002   4.3 9.03e-001 1.00e+000f  1
  53r1.0000000e+000 3.19e+003 5.73e+004   0.7 8.67e-002   4.7 6.12e-001 1.00e+000f  1
  54r1.0000000e+000 3.19e+003 5.38e+004   0.7 1.09e-001   5.1 1.55e-001 6.96e-002f  1
  55r1.0000000e+000 3.19e+003 4.94e+004   0.7 4.67e-001   4.6 8.91e-002 9.90e-002f  1
  56r1.0000000e+000 3.19e+003 4.48e+004   0.7 1.40e-001   5.1 3.39e-001 1.99e-001f  1
  57r1.0000000e+000 3.19e+003 3.69e+004   0.7 1.76e-001   4.6 8.44e-001 5.09e-001f  1
  58r1.0000000e+000 3.19e+003 1.97e+004   0.7 2.32e-001   4.1 6.74e-001 3.75e-001f  1
  59r1.0000000e+000 3.19e+003 2.01e+003   0.7 5.95e-002   4.5 1.00e+000 1.00e+000f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  60r1.0000000e+000 3.19e+003 1.38e+003   0.7 8.90e-002   4.1 8.42e-001 4.25e-001f  1
  61r1.0000000e+000 3.19e+003 1.12e+003   0.7 2.74e-001   3.6 6.18e-001 2.50e-001f  1
  62r1.0000000e+000 3.19e+003 1.45e+003   0.7 9.71e-001   3.1 3.96e-001 1.01e-001f  1
  63r1.0000000e+000 3.19e+003 9.99e+002   0.7 2.40e+000   2.6 5.66e-001 2.06e-001f  1
  64r1.0000000e+000 3.19e+003 8.27e+004   0.7 9.01e-001   3.0 4.92e-001 1.85e-001f  1
  65r1.0000000e+000 3.19e+003 1.45e+006   0.7 3.38e-001   3.5 1.00e+000 4.09e-001f  1
  66r1.0000000e+000 3.19e+003 1.38e+006   0.7 1.59e+000   3.0 6.84e-002 1.54e-001f  1
  67r1.0000000e+000 3.19e+003 1.12e+006   0.7 8.15e-001   3.4 1.52e-001 5.24e-001f  1
  68r1.0000000e+000 3.19e+003 9.10e+005   0.7 4.15e-001   3.8 4.66e-001 2.84e-001f  1
  69r1.0000000e+000 3.19e+003 9.10e+005   0.7 2.43e+001   3.4 7.37e-003 3.81e-004h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  70r1.0000000e+000 3.19e+003 4.96e+005   0.7 5.13e-001   3.8 2.59e-001 1.00e+000f  1
  71r1.0000000e+000 3.19e+003 4.74e+005   0.7 9.71e-001   4.2 8.99e-002 4.43e-002f  1
  72r1.0000000e+000 3.19e+003 3.25e+005   0.7 2.89e-001   4.6 4.77e-001 4.19e-001f  1
  73r1.0000000e+000 3.19e+003 2.92e+005   0.7 2.67e-001   5.1 1.37e-001 2.64e-001f  1
  74r1.0000000e+000 3.19e+003 2.57e+005   0.7 3.92e+000   4.6 6.00e-003 7.71e-002h  1
  75r1.0000000e+000 3.19e+003 2.51e+005   0.7 2.66e+000   5.0 9.47e-002 3.15e-002h  1
  76r1.0000000e+000 3.19e+003 2.51e+005   0.7 5.36e-001   5.4 1.26e-001 1.65e-003h  1
  77r1.0000000e+000 3.19e+003 2.47e+005   0.7 6.22e-001   5.9 2.62e-003 2.22e-002f  1
  78r1.0000000e+000 3.19e+003 3.11e+005   0.7 4.98e-001   5.4 1.55e-002 3.31e-001f  1
  79r1.0000000e+000 3.19e+003 1.29e+005   0.7 7.78e-001   4.9 2.31e-001 7.94e-001f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  80r1.0000000e+000 3.19e+003 3.16e+004   0.7 2.89e-001   4.4 4.59e-002 1.00e+000f  1
  81r1.0000000e+000 3.19e+003 5.46e+003   0.7 1.08e-001   4.0 9.14e-001 4.75e-001f  1
  82r1.0000000e+000 3.19e+003 2.73e+003   0.7 3.25e-001   3.5 2.69e-001 4.26e-001f  1
  83r1.0000000e+000 3.19e+003 1.73e+003   0.7 9.76e-001   3.0 4.05e-001 2.97e-001f  1
  84r1.0000000e+000 3.19e+003 1.49e+003   0.7 3.66e-001   3.4 1.00e+000 1.40e-001f  1
  85r1.0000000e+000 3.19e+003 9.99e+002   0.7 1.10e+000   3.0 7.08e-001 5.09e-001f  1
  86r1.0000000e+000 3.19e+003 9.99e+002   0.7 4.12e-001   3.4 1.00e+000 2.02e-001f  1
  87r1.0000000e+000 3.19e+003 1.15e+003   0.7 1.23e+000   2.9 4.51e-001 5.90e-002f  1
  88r1.0000000e+000 3.19e+003 1.46e+003   0.7 9.01e-001   3.3 4.76e-001 1.47e-001f  1
  89r1.0000000e+000 3.19e+003 1.20e+003   0.7 1.39e+000   2.9 1.00e+000 3.88e-001f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  90r1.0000000e+000 3.19e+003 1.85e+003   0.7 4.17e+000   2.4 7.44e-001 7.41e-002f  1
  91r1.0000000e+000 3.19e+003 3.62e+003   0.7 1.25e+001   1.9 4.51e-001 8.65e-002f  1
  92r1.0000000e+000 3.19e+003 2.01e+003   0.7 4.69e+000   2.3 1.00e+000 1.35e-001f  1
  93r1.0000000e+000 3.19e+003 2.59e+003   0.7 1.41e+001   1.9 9.76e-002 1.18e-001f  1
  94r1.0000000e+000 3.19e+003 2.59e+003   0.7 6.59e-001   3.2 1.00e+000 3.80e-001f  1
  95r1.0000000e+000 3.19e+003 2.35e+003   0.7 1.98e+000   2.7 5.13e-001 4.15e-001f  1
  96r1.0000000e+000 3.19e+003 3.01e+003   0.7 5.93e+000   2.2 1.00e+000 3.64e-001f  1
  97r1.0000000e+000 3.19e+003 3.22e+003   0.7 2.22e+000   2.7 1.00e+000 5.73e-001f  1
  98r1.0000000e+000 3.18e+003 1.25e+003   0.7 6.67e+000   2.2 6.56e-001 4.76e-001f  1
  99r1.0000000e+000 3.18e+003 1.22e+003   0.7 2.50e+000   2.6 1.00e+000 2.42e-002f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
 100r1.0000000e+000 3.18e+003 2.27e+003   0.7 7.51e+000   2.1 1.19e-001 1.41e-001f  1

Number of Iterations....: 100

                                   (scaled)                 (unscaled)
Objective...............:  1.0000000000000000e+000   1.0000000000000000e+000
Dual infeasibility......:  2.2653433308109729e+003   2.2653433308109729e+003
Constraint violation....:  3.1839522727329108e+003   6.7124334869609377e+005
Complementarity.........:  6.0142110405593208e+000   6.0142110405593208e+000
Overall NLP error.......:  3.1839522727329108e+003   6.7124334869609377e+005


Number of objective function evaluations             = 122
Number of objective gradient evaluations             = 8
Number of equality constraint evaluations            = 125
Number of inequality constraint evaluations          = 125
Number of equality constraint Jacobian evaluations   = 102
Number of inequality constraint Jacobian evaluations = 102
Number of Lagrangian Hessian evaluations             = 100
Total CPU secs in IPOPT (w/o function evaluations)   =     42.638
Total CPU secs in NLP function evaluations           =     29.731

EXIT: Maximum Number of Iterations Exceeded.
WARNING: Loading a SolverResults object with a warning status into model=unknown;
    message from solver=Ipopt 3.8.1\x3a Maximum Number of Iterations Exceeded.

Process finished with exit code 0

0 个答案:

没有答案