[R] how to solve a min problem
RAVI VARADHAN
rvaradhan at jhmi.edu
Wed Jul 4 20:21:26 CEST 2007
If the constraints on S are linear inequalities, then linear programming methods would work. See function solveLP in package "linprog" or simplex in "boot" or package "lpSolve".
Ravi.
----- Original Message -----
From: domenico pestalozzi <statadat at gmail.com>
Date: Wednesday, July 4, 2007 11:26 am
Subject: Re: [R] how to solve a min problem
To: R-help <r-help at stat.math.ethz.ch>
> S is an array 1-dimensional, for example 1 X 10, and mean(S) is the
> mean of
> these 10 elements.
>
> So, I want to do:
>
> minimize mean(S) with 0 < b_func(S) < 800.
> That is, there are some boundaries on S according the b_funct
>
> The function apply an iterative convergent criterion:
>
> f_1=g(S), f_2=g(f_1), f_3=g(f_2), ecc....
> The function stops when
> f_n - f_n-1 <=0.1e-09
> and g(S) is a non-linear function of S and the convergence is mathematically
> assured.
>
> Is it possible to use 'optimize'?
>
> thanks
>
> domenico
>
>
> 2007/7/3, Spencer Graves <spencer.graves at pdf.com>:
> >
> > Do you mean
> >
> > minimize mu with 0 < b_func(S+mu) < 800?
> >
> > For this kind of problem, I'd first want to know the nature of
> > "b_func". Without knowing more, I might try to plot b_func(S+mu) vs.
> > mu, then maybe use 'optimize'.
> >
> > If this is not what you mean, please be more specific: I'm
> > confused.
> >
> > Hope this helps.
> > Spencer Graves
> >
> > domenico pestalozzi wrote:
> > > I know it's possible to solve max e min problems by using these
> > functions:
> > >
> > > nlm, optimize, optim
> > >
> > > but I don't know how to use them (...if possible...) to solve this
> > problem.
> > >
> > > I have a personal function called b_func(S) where S is an input
> array
> > (1 X
> > > n) and I'd like:
> > >
> > > minimize mean(S) with 0 < b_funct < 800.
> > >
> > > I know that the solution exists, but It's possible to calculate
> it in R?
> > > The b_func is non linear and it calculates a particular value
> using S as
> > > input and applying a convergent iterative algorithm.
> > >
> > > thanks
> > >
> > >
> > > domenico
> > >
> > > [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > R-help at stat.math.ethz.ch mailing list
> > >
> > > PLEASE do read the posting guide
> >
> > > and provide commented, minimal, self-contained, reproducible code.
> > >
> >
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
>
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list