[R] Problem with constrained optimization with maxBFGS

2011-05-11 Thread Leonardo Monasterio
Dear all, I need to maximize the v: v= D' W D D is a column vector ( n , 1) W is a given matrix (n, n) subject to: sum D= 1 (BTW, n is less than 300) I´ve tried to use maxBFGS, as follows: # objectiveFunction-function(x) { return(t(D)%*%W%*%D) }

[R] How to calculate the perimeter and common border of polygons?

2011-02-18 Thread Leonardo Monasterio
Dear R-users, Is there any way of calculating the perimeter of a polygon in a shapefile object? Furthermore, how to calculate the length of the common border of two polygons? I've searched the code of spded, but could not find a hint on how to do it. Thank you very much, Leo.

[R] Indentify polygons that are on the border of a shapefile

2011-02-17 Thread Leonardo Monasterio
Dear R users, I would like to know how to indentify the polygons that are located on the border of a map (i.e.shapefile). Do you have any suggestion on how to do it? Thank you very much, Leo Monasterio. [[alternative HTML version deleted]]

[R] constrained optimization -which package?

2010-09-28 Thread Leonardo Monasterio
Dear R users, I want to find the maximum value of v, subject to the constrain that the sum of x is equal to 1. So, I want to maximize: v-t(x)%*%distance%*%x Subject to: sum(x)=1 Where: x is a vector n X 1 distance is a matrix n*n and it is given. (In practive, the number of n can go up to

[R] constrained optimization -which package?

2010-09-28 Thread Leonardo Monasterio
Dear R users, In the function bellow I want to find the maximum value of v, subject to the constrain that the sum of x is equal to 1. I want to maximize: v-t(x)%*%distance%*%x Subject to: sum(x)=1 Where: x is a vector n X 1 distance is a matrix n*n and it is given. (In practice, the number of