import tensorflow as tf

bounds = []
for v in variables:
    key = v.name[:v.name.find(':')]
    lower, upper = constraint[key]
    bounds.append((lower, upper))


max_steps = 1000
status_every = 1


# Create an optimizer with the desired parameters.
opt = tf.contrib.opt.ScipyOptimizerInterface(nll,
                                             options={'maxiter': max_steps,
                                                      # 'disp': True,
                                                      # 'tol': 1e-20,
                                                      'maxls': 10,
                                                      },
                                             # inequalities=inequalities,
                                             # method='SLSQP'  # supports inequalities
                                             # method='BFGS',
                                             bounds=bounds,
                                             var_list=variables,  # supply with bounds to match order!
                                             tol=1e-14,
