# [SciPy-user] Generating tuples and lists connected with optimize.fmin_l_bfgs_b(func, guess, bounds=bounds, iprint=-1)

Nils Wagner nwagner at mecha.uni-stuttgart.de
Fri Jul 1 06:43:32 CDT 2005

```Christian Kristukat wrote:

> Nils Wagner wrote:
>
>> Is it possible to solve constrained optimization problems of the form
>>
>> min f(x)
>>
>> s.t.
>>
>> 0 < x_1 < =1
>> 0 < x_2 < =1
>>
>> n(x) = 0
>> with scipy. n(x) denotes a nonlinear function  of the design
>> variables  x^T=[x_1,\dots,x_n]
>> So we have both equality and inequality constraints.
>
>
> Might be stupid, but as we are limited to machine precision, one could
> take the machine precision as lower limit:
> eps <= x_1 <= 1
> That should be equal to 0 < x_1. Correct me if I'm wrong.
>
> Regards, Christian
>
I agree, but how about the nonlinear equality constraint.
As far as I understand it, I have to use fmin_cobyla which offers an
argument cons for constraints.
However these constraints must be >=0 insetad of = 0 in my case.
Am I missing something ?

Cheers,

Nils

fmin_tnc(func, x0, fprime=None, args=(), approx_grad=False, bounds=None,
epsilon=1e-08, scale=None, messages=15, maxCGit
=-1, maxfun=None, eta=-1, stepmx=0, accuracy=0, fmin=0, ftol=0, rescale=-1)
Minimize a function with variables subject to bounds, using gradient
information.

fmin_cobyla(func, x0, cons, args=(), consargs=None, rhobeg=1.0,
rhoend=0.0001, iprint=1, maxfun=1000)
Minimize a function using the Contrained Optimization BY Linear
Approximation
(COBYLA) method

Arguments:

func     -- function to minimize. Called as func(x, *args)

x0       -- initial guess to minimum

cons     -- a list of functions that all must be >=0 (a single function
if only 1 constraint)

args     -- extra arguments to pass to function

consargs -- extra arguments to pass to constraints (default of None
means
use same extra arguments as those passed to func).  Use
() for no
extra arguments.

rhobeg --  reasonable initial changes to the variables

rhoend --  final accuracy in the optimization (not precisely guaranteed)

iprint  -- controls the frequency of output: 0 (no output),1,2,3

maxfun  -- maximum number of function evaluations.

Returns:

x -- the minimum

>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user

```