本文整理汇总了Python中solver.Solver.trust_expand_ratio方法的典型用法代码示例。如果您正苦于以下问题:Python Solver.trust_expand_ratio方法的具体用法?Python Solver.trust_expand_ratio怎么用?Python Solver.trust_expand_ratio使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类solver.Solver
的用法示例。
在下文中一共展示了Solver.trust_expand_ratio方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Solver
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import trust_expand_ratio [as 别名]
from variable import Variable
from expr import *
import numpy as np
from ipdb import set_trace as st
solv = Solver()
"""
values taken from Pieter Abbeel's CS287 hw3 q2 penalty_sqp.m file
"""
solv.improve_ratio_threshold = .25
solv.min_trust_region_size = 1e-5
solv.min_approx_improve = 1e-8
solv.max_iter = 50
solv.trust_shrink_ratio = .1
solv.trust_expand_ratio = 1.5
solv.cnt_tolerance = 1e-4
solv.max_merit_coeff_increases = 5
solv.merit_coeff_increase_ratio = 10
solv.initial_trust_region_size = 1
solv.initial_penalty_coeff = 1.
zerofunc = lambda x: np.array([[0.0]])
neginffunc = lambda x: np.array([[-1e5]])
N = 2
def test_prob(ut, x0, x_true, f=zerofunc, g=neginffunc, h=zerofunc,
Q=np.zeros((N,N)), q=np.zeros((1,N)), A_ineq=np.zeros((1,N)),
b_ineq=np.zeros((1,1)), A_eq=np.zeros((1,1)), b_eq=np.zeros((1,1))):
if not np.allclose(A_eq, np.zeros((1,1)))\