0

Working with 'scipy.optimize.minimize' I'm having strange using of the minimize procedure. Below is test code to show my results:

import numpy as np
import pandas as pd
from scipy.optimize import minimize

def SES(good, a, h):
  print('good is : {}'.format(good))
  print('a is : {}'.format(a))
  print('h is : {}'.format(h))
  return 0

good = [1,2,3,4,5,6]
a = minimize(SES, x0 = good, args=(0.1, 1), method = 'L-BFGS-B', bounds = [[0.1, 0.3]]*len(good))
 

I'm expecting that SES function will print for 'good' parameter the values [1,2,3,4,5,6]. But I'm receiving the following output

good is : [0.3 0.3 0.3 0.3 0.3 0.3]
a is : 0.1
h is : 1

If I remove bounds parameter then I receive output as I expect:

a = minimize(SES, x0 = good, args=(0.1, 1), method = 'L-BFGS-B')

good is : [1. 2. 3. 4. 5. 6.]
a is : 0.1
h is : 1

Could you explain what I'm doing wrong...

Roman Kazmin
  • 931
  • 6
  • 18

1 Answers1

0

It seems I know where is problem. The good is out of bounds therefore I have this result..

Roman Kazmin
  • 931
  • 6
  • 18