- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在模拟中求解一组方程(IMODE = 1,SOLVER = 3)。 IPOPT 求解器求解到可接受的水平并退出,但 gekko 为此返回错误并返回我的解决方案。根据 IPOPT 文档,可接受级别的公差为 1.0e-6,这与 gekko 使用的 OTOL 和 RTOL 的默认值(以及我正在使用的值)相同。我能够修改 gekko.py 源代码以获得返回的答案,但这样做我绕过了所有类型的错误。我不希望绕过所有错误,因为它们显然有助于调试其他问题,如不可行性。是否有我遗漏的 m.solve 选项,或其他在 IPOPT 求解到可接受水平时不触发错误的方法?
最佳答案
处理求解器错误的一种方法是将求解命令包装在 try
、except
语句中。 APPINFO输出可能会指导您遇到什么类型的错误,并让您对“不可行的解决方案”、“解决到可接受的水平”或 other IPOPT error codes 做出不同的 react 。 .
try:
m.solve(disp=True)
except:
print('Solver error, looking at APPINFO')
if m.options.APPINFO==1:
print('APPINFO=1')
elif m.options.APPINFO==2:
print('APPINFO=2')
另一种选择是 try a different solver such as APOPT or BPOPT .
m.options.SOLVER = 1
编辑:当 Gekko 引发求解器异常时,参数 APPINFO
不会更新。使用 debug=0
尝试以下操作:
m.solve(disp=True,debug=0)
if m.options.APPINFO!=0:
print('Solver error, looking at APPINFO')
if m.options.APPINFO==1:
print('APPINFO=1')
elif m.options.APPINFO==2:
print('APPINFO=2')
我刚刚更新了 Gekko,这样远程解决也将绕过引发的异常并完成处理带有 APPINFO
信息的选项文件。 APPINFO
信息在本地运行时在run目录下的options.json
中,在gk_post_solve.py<中用
.load_JSON
读入
关于 python 壁虎 : How to avoid raising an error from IPOPT "Solved to Acceptable Level.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58019008/
我正在尝试将网页内容打印到一页纸上。但是,它将内容分成 2 页,所以我在这里做了一些研究,看到有人推荐: #my_print_div{ width:940px; height:770px; page
我目前正在打印一些东西。我有一个动态页面,其中包含可变数量的 block 级元素。有些可能是 1 行,有些可能是 100 多行。 1text 1 line.... 2text 10 lines....
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 9
我正在训练一个 randomForest 模型,目的是保存它以进行预测(它将被下载并在外部上下文中使用)。我希望这个模型尽可能最小。 我读到有很多options和 packages减少模型的内存大小。
这个问题在这里已经有了答案: MySQL connection timeout (3 个答案) 关闭 9 年前。 我一直在尝试使用 Tomcat 的 native 连接池功能来避免我的 Java W
我正在使用 Phonegap/Cordova 开发 Android 应用程序。我已经按照这样的百分比安排了我的布局(在 CSS 中): 标题 - 50px; Content_row1 - 30%(剩下
我正在编写一个插件,它将表情符号转换为特定站点文本 block 中的图像。简单的答案是使用正则表达式检测 innerHTML 上的触发文本并插入 img 标签,然后将字符串通过管道返回到 innerH
如何避免在我的 Drupal View 上重复? 我应该添加一个过滤器,指定特定字段(即用户 ID)不应出现两次吗?我找不到这样的选项 看法 http://dl.dropbox.com/u/72686
感谢您查看我的 typescript 问题。 为简单起见,我对 typescript “过度属性检查”行为有疑问。我想确保 TypeScript 不接受具有额外属性的对象。 在我的简单界面示例中,OF
我发现对于某些图表,我从 Prometheus 获得了 doubles 值,其中应该只是一个: 我使用的查询: increase(signups_count[4m]) 抓取间隔设置为 recommen
假设我正在运行N个线程。 每个线程都需要与下一个和上一个同步。 for (i = 0 ; i < NITER; i++){ do_something (); sync_
如今,服务器虚拟化是一件大事,所以我的任务是在虚拟化服务器上安装我们的一些软件,看看会发生什么。长话短说:rsync 传输会立即使虚拟化服务器崩溃。虚拟化主机是一台强大的机器,没有其他负载;我认为
以下正则表达式在应用于大型 html 页面时会创建 StackOverflowError: (.|\s)*? 我的假设是,这是由于逻辑“OR”运算符(|)在匹配器中创建了递归调用,并且由于需要解析的
我在运行时使用表达式树构建委托(delegate): Type type = GetType(); ParameterExpression parameterType = Expression.Par
我正在使用 scikit-learn TfidfVectorizer 找出两个文档中最重要的单词。每个文档大小为 1.9GB(约 9000 万字),并且已采用小写、词干化(使用 nltk.stem.p
我进行了一个中间件调用来获取 String 数组,如下所示: String[] freqwords = MViewer.getWordNames(); 问题是可能没有可用数据,因此任何进一步的操作(如
在 JavaFx 中,我使用以下代码创建一个 StackedBarChart: String[] ACTIVITIES = new String[10]{ ... };// there
我正在尝试制作一个使用类 AnimationTimer 来处理它的游戏。我的代码摘要如下所示: 主类 object Game extends JFXApp{ def showMenu{
我正在用不同的步骤创建一个小的 javascript/jQuery 应用程序。为此,我使用了一个具有不同功能的 js 文件。 在文件的顶部我调用了我的第一个函数。在我的第一个函数中,我在单击按钮时调用
我正在使用表格 View 来显示从服务器加载的文本字段数组,所以我有一个表格 View 字段列表,当我填充这些数据字段并向下滚动以填充其他字段时,当我再次向上滚动时,我发现值发生变化并且存在重复值 -
我是一名优秀的程序员,十分优秀!