You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Anaconda中Pyomo求解器结果与命令行不一致问题咨询

Inconsistent Pyomo Solver Results Between Anaconda Environment and Command Line

Hey folks, I'm running into a confusing issue with Pyomo solver results and could use some help sorting it out.

Here's my setup:

  • Windows 10 64-bit system
  • Python 3.6 in an Anaconda environment
  • I've got both GLPK and IPOPT solvers installed

I'm working with the Rosenbrock optimization example—this code matches what's on page 64 of a reference PDF, and is nearly identical to the example in pyomo_examples\doc\pyomobook\nonlinear-ch\rosen:

from pyomo.environ import *
model = ConcreteModel()
model.x = Var(initialize=-1.2, bounds=(-2, 2))
model.y = Var(initialize=1.0, bounds=(-2, 2))
model.obj = Objective(expr=(1-model.x)**2 + 100*(model.y-model.x**2)**2,sense=minimize)

The problem? When I run this model within my Anaconda environment (either via a Jupyter notebook or an Anaconda Prompt script), the solver outputs don't match what I get when running the exact same code through a standard Windows command line.

I've double-checked that I'm using the same solvers and code in both cases, but the discrepancy persists. Has anyone run into this before, or have ideas on what might be causing this?

内容的提问来源于stack exchange,提问作者PointOnePA

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 11:21:28