jskoien / intamapInteractive

2 stars 0 forks source link

spatial perturbation #3

Open OrdinarySK opened 2 years ago

OrdinarySK commented 2 years ago

Hello, I coded a piece of code for multi-object spatial site sampling based on the AMOSA algorithm, but I found that my spatial perturbations didn't seem right. Can you give some advice, below is my perturbation code.

` x_extent = x_extent-iter/iterationx_extent y_extent = y_extent-iter/iterationy_extent temp_pt[j,1] = curr_pt[j,1] + x_extent runif(1, -0.2, 0.2) temp_pt[j,2] = curr_pt[j,2] + y_extent runif(1, -0.2, 0.2)

    while(point.in.polygon(temp_pt[j,1], temp_pt[j,2], candidates@polygons[[1]]@Polygons[[1]]@coords[,1],
                           candidates@polygons[[1]]@Polygons[[1]]@coords[,2]) != 1){
      temp_pt[j,1] = curr_pt[j,1] + x_extent * runif(1, -0.2, 0.2)
      temp_pt[j,2] = curr_pt[j,2] + y_extent * runif(1, -0.2, 0.2)
    }

`

jskoien commented 2 years ago

Dear, I am not sure if this is really a question about the package? Although I am maintaining the package, I am not responsible for the simulated annealing. And as I cannot reproduce it (missing input data, and maybe incomplete code), I am also not able to see what kind of problem there is with the script..

Best, Jon

On Sun, 6 Mar 2022 at 08:30, OrdinarySK @.***> wrote:

Hello, I coded a piece of code for multi-object spatial site sampling based on the AMOSA algorithm, but I found that my spatial perturbations didn't seem right. Can you give some advice, below is my perturbation code.

` x_extent = x_extent-iter/iteration x_extent y_extent = y_extent-iter/iterationy_extent temp_pt[j,1] = curr_pt[j,1] + x_extent runif(1, -0.2, 0.2) temp_pt[j,2] = curr_pt[j,2] + y_extent runif(1, -0.2, 0.2)

while(point.in.polygon(temp_pt[j,1], temp_pt[j,2], ***@***.******@***.******@***.***[,1],
                       ***@***.******@***.******@***.***[,2]) != 1){
  temp_pt[j,1] = curr_pt[j,1] + x_extent * runif(1, -0.2, 0.2)
  temp_pt[j,2] = curr_pt[j,2] + y_extent * runif(1, -0.2, 0.2)
}

`

— Reply to this email directly, view it on GitHub https://github.com/jskoien/intamapInteractive/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNRTDZYIST34XQ334JH5HTU6RNJXANCNFSM5QAYLUFQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>