Skip to content

Commit 3353991

Browse files
committed
fix bounds warning
1 parent 723b21f commit 3353991

File tree

1 file changed

+4
-2
lines changed
  • lectures/_static/lecture_specific/chang_credible

1 file changed

+4
-2
lines changed

lectures/_static/lecture_specific/chang_credible/changecon.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,16 +369,18 @@ def p_fun2(x):
369369
p_iter1 = np.zeros(order)
370370
for i in range(order):
371371
θ = s[i]
372+
x0 = np.clip(lb1 + (ub1-lb1)/2, lb1, ub1)
372373
res = minimize(p_fun,
373-
lb1 + (ub1-lb1) / 2,
374+
x0,
374375
method='SLSQP',
375376
bounds=bnds1,
376377
constraints=cons1,
377378
tol=1e-10)
378379
if res.success == True:
379380
p_iter1[i] = -p_fun(res.x)
381+
x0 = np.clip(lb2 + (ub2-lb2)/2, lb2, ub2)
380382
res = minimize(p_fun2,
381-
lb2 + (ub2-lb2) / 2,
383+
x0,
382384
method='SLSQP',
383385
bounds=bnds2,
384386
constraints=cons2,

0 commit comments

Comments
 (0)