[R] Maximization Problem

cberry at tajo.ucsd.edu cberry at tajo.ucsd.edu
Tue Oct 25 19:49:36 CEST 2011


Eliano Marques <eliano.m.marques at gmail.com> writes:

> Hi there,
>
> I need help in an optimization procedement.
>
> I'm trying to maximize the function fn=x^2+5y^2 with the restriction of
> fn1=x-y<=5.
>
> I tried the genoud method and as well the alabama method.
>
> I have problems to set the constraint in R.
>
> Can someone help me please?

Probably not.

 fn <- function(x,y) x^2+5*y^2
 fn1 <- function(x) x-5 # solve for y at boundary
 curve( fn(x,fn1(x)), -1000,1000)

what maximum?

Chuck

>
> Regards,
> Eliano
>
> 	[[alternative HTML version deleted]]
>

-- 
Charles C. Berry                            Dept of Family/Preventive Medicine
cberry at tajo.ucsd.edu			    UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901



More information about the R-help mailing list