-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added getMinAOO which uses Simulated annealing to determine the optim… #2
base: master
Are you sure you want to change the base?
Conversation
…al shift parameters.
Added parscale that scales with grid.size and maxit.
I tried running the function with a test dataset I have which is a subset of mangroves in Victoria (it has a dimension of 1167x1502, resolution at 30m) and running it at the default maxiter (10,000) took way too long. I've cut that down to 500 to try it out, but it didn't manage to capture a good AOO. |
Would you be able to upload the dataset as part of the package so we can use in the @examples? and so I can have something to test it on. The SANN method of optim is pretty slow but the function we are trying to optimize is very flat a lot of the time so the much faster gradient methods tend to think that we are in a global min all the time based off local flat information. In the latest commit I have implemented it as a call to constrOptim with max it = 500 it seems to be running a lot faster. |
R/AOO_functions.R
Outdated
@@ -199,12 +198,25 @@ getMinAOO <- function(ecosystem.data, grid.size, | |||
min.percent.rule = min.percent.rule, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the previous line: grid = shift(grid, x = x[1], y = x[2]), doesn't x[2] just make the value default to NA?
Since optim() only takes 1 variable for optimization, doesn't that mean it just searches diagonally (x=y)? Or am I completely misunderstanding what x[2] does...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
objective_function
takes a vector
run print(o)
before the function exits to see, $par is the argmin
Bounds of either (0, grid.size) or (-0.5grid.size, 0.5grid.size) will both be good. |
temp = grid.size, | ||
tmax = 50, | ||
maxit = 500, | ||
parscale = c(grid.size, grid.size), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I understand of the parscale parameter, doesn't this mean that the adjustments moved will be too big (the whole grid we're working at)?
Thanks John, I can't say that I 100% understand how the barrier function works, but it looks good! I was wondering if there's a way of forcing o$par to be an integer, rather than numeric? It doesn't make much sense to be varying at those levels when our bounds are at 10,000. Might also give us better results if it's running at larger steps (as opposed to 3d.p.) I'm also a bit worried about the run-time because the |
…al shift parameters.
You can run the changes after pulling and building with
examples(getMinAOO)
One problem that might come up is that I dont think the values of xshift and yshift are constrained but I havent run into any issues yet.