前提・実現したいこと
ipoptによる最適化ができません。
発生している問題・エラーメッセージ
Ipopt 3.12.12: ==> Warning: Treating 0 binary and 1000 integer variables as continous. ****************************************************************************** This program contains Ipopt, a library for large-scale nonlinear optimization. Ipopt is released as open source code under the Eclipse Public License (EPL). For more information visit http://projects.coin-or.org/Ipopt ****************************************************************************** This is Ipopt version 3.12.12, running with linear solver mumps. NOTE: Other linear solvers might be more efficient (see Ipopt documentation). Number of nonzeros in equality constraint Jacobian...: 1000 Number of nonzeros in inequality constraint Jacobian.: 540 Number of nonzeros in Lagrangian Hessian.............: 30300 Error in an AMPL evaluation. Run with "halt_on_ampl_error yes" to see details. Error evaluating objective gradient at user provided starting point. No scaling factor for objective function computed! Total number of variables............................: 1300 variables with only lower bounds: 0 variables with lower and upper bounds: 1300 variables with only upper bounds: 0 Total number of equality constraints.................: 100 Total number of inequality constraints...............: 270 inequality constraints with only lower bounds: 0 inequality constraints with lower and upper bounds: 0 inequality constraints with only upper bounds: 270 iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls 0 -4.4966040e+02 9.00e-01 5.01e+01 -1.0 0.00e+00 - 0.00e+00 0.00e+00 0 1 -9.8620678e+02 8.17e-01 9.22e+03 -1.0 1.07e-01 4.0 9.83e-01 9.25e-02f 1 2 -1.0260026e+03 8.10e-01 9.64e+05 -1.0 8.17e-02 8.0 8.25e-01 7.98e-03f 1 3 -1.0609083e+03 8.10e-01 4.52e+21 -1.0 8.10e-02 12.1 3.87e-01 8.83e-05f 1 WARNING: Problem in step computation; switching to emergency mode. 4r-1.0609083e+03 8.10e-01 1.00e+03 -0.1 0.00e+00 20.0 0.00e+00 0.00e+00R 1 5r-3.2534985e+03 4.76e-01 9.99e+02 -0.1 3.78e+02 - 7.97e-05 2.12e-03f 1 6 -3.2537319e+03 4.76e-01 8.46e+07 -1.0 8.46e-07 14.0 1.00e+00 1.00e+00h 1 7 -3.2888275e+03 4.76e-01 8.87e+08 -1.0 4.76e-02 13.5 4.54e-01 2.91e-04f 1 ERROR: Solver (ipopt) returned non-zero return code (-11) ERROR: See the solver log above for diagnostic information. --------------------------------------------------------------------------- ApplicationError Traceback (most recent call last) <ipython-input-49-e31fc9a31c36> in <module> 30 31 opt = SolverFactory("ipopt") ---> 32 result = opt.solve(model, tee=True) 33 model.display() 34 solver.options['print_level'] = 12 ~/opt/anaconda3/lib/python3.7/site-packages/pyomo/opt/base/solvers.py in solve(self, *args, **kwds) 594 logger.error("Solver log:\n" + str(_status.log)) 595 raise ApplicationError( --> 596 "Solver (%s) did not exit normally" % self.name) 597 solve_completion_time = time.time() 598 if self._report_timing: ApplicationError: Solver (ipopt) did not exit normally
該当のソースコード
python
1 2from pyomo.environ import * 3 4I=100 5J=30 6T=10 7 8model=ConcreteModel() 9model.Candidate=range(I) 10model.Item=range(J) 11model.Class=range(T) 12 13model.x=Var(model.Item,model.Class,bounds=(0.0,1.0)) 14model.y=Var(model.Candidate,model.Class,within=Binary) 15 16#目的関数 17model.obj=Objective( expr=sum( model.y[i,t]*u_ij[i,j]*log(model.x[j,t])+model.y[i,t]*(1-u_ij[i,j])*log(1-model.x[j,t]) for i in model.Candidate for j in model.Item for t in model.Class )) 18 19 20#制約条件1 21model.mono=ConstraintList() 22for j in model.Item: 23 for t in model.Class: 24 if t<=8: 25 model.mono.add( model.x[j,t] <= model.x[j,t+1]) 26 27#制約条件2 28model.single_y=ConstraintList() 29for i in model.Candidate: 30 model.single_y.add( sum( model.y[i,t] for t in model.Class ) == 1) 31 32opt = SolverFactory("ipopt") 33result = opt.solve(model, tee=True) 34model.display() 35solver.options['print_level'] = 12 36solver.options['output_file'] = "my_ipopt_log.txt"
あなたの回答
tips
プレビュー