wpeterman / ResistanceGA

Optimize resistance surfaces using Genetic Algorithms
37 stars 15 forks source link

Optimization problems #12

Closed AridaiHari closed 4 years ago

AridaiHari commented 4 years ago

Hello, I used the code below for optimization with the GA package , but I have been getting errors.

dir.create(file.path("./Optimized")) dir.create(file.path("./Optimized", "07042020"))
write.dir <- "./Optimized/07042020"

Optimization

GA.inputs_All <- GA.prep(method = "AIC", ASCII.dir = CVM, Results.dir = write.dir, min.cat = 0,
select.trans = list("A", NA , "A", "A", "A", "A", NA, "A", "A", "A", "A", "A"), parallel = 4)

And it produces this warning:

Warning message: In dir.create(file.path(Results.DIR, "Plots")) : cannot create dir '.\Optimized\07042020Results\Plots', reason 'No such file or directory'

the code creates 07042020, Results and tmp directories but not Plots.

I hope I can have an answer. Thank you!

wpeterman commented 4 years ago

Not certain, but I might suggest specifying the full directory rather than a relative path to your write.dir. This ultimately shouldn't matter, but may be the issue in this case.

Bill Peterman Assistant Professor School of Environment and Natural Resources The Ohio State University 2021 Coffey Road Columbus, OH 43210-1085 Phone: 614.292.9795 Web Page https://goo.gl/4Gc15W Terrestrial Wildlife Ecology Lab http://www.twel.osu.edu

On Tue, Apr 7, 2020 at 4:57 PM AridaiHari notifications@github.com wrote:

Hello, I used the code below for optimization with the GA package , but I have been getting errors.

dir.create(file.path("./Optimized")) dir.create(file.path("./Optimized", "07042020")) write.dir <- "./Optimized/07042020"

Optimization

GA.inputs_All <- GA.prep(method = "AIC", ASCII.dir = CVM, Results.dir = write.dir, min.cat = 0, select.trans = list("A", NA , "A", "A", "A", "A", NA, "A", "A", "A", "A", "A"), parallel = 4)

And it produces this warning:

Warning message: In dir.create(file.path(Results.DIR, "Plots")) : cannot create dir '.\Optimized\07042020Results\Plots', reason 'No such file or directory'

the code creates 07042020, Results and tmp directories but not Plots.

I hope I can have an answer. Thank you!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/wpeterman/ResistanceGA/issues/12, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDLQUJMMAM6UM54WAOF2A3RLOHRZANCNFSM4MDNRFFQ .

AridaiHari commented 4 years ago

Actually I tried the complete path but the error is still the same

CVM<-stack("C:/Users/Gabriela/Documents/CutByLadera/CVM_stack.tif") dir.create(file.path("C:/Users/Gabriela/Documents/CutByLadera/Optimized")) dir.create(file.path("C:/Users/Gabriela/Documents/CutByLadera/Optimized", "07042020"))

write.dir <- "C:/Users/Gabriela/Documents/CutByLadera/Optimized/07042020"

GA.inputs_All <- GA.prep(method = "AIC", ASCII.dir = CVM, Results.dir = write.dir, min.cat = 0,
select.trans = list("A", NA , "A", "A", "A", "A", NA, "A", "A", "A", "A", "A"), parallel = 4)

Warning message: In dir.create(file.path(Results.DIR, "Plots")) : cannot create dir 'C:\Users\Gabriela\Documents\CutByLadera\Optimized\07042020Results\Plots', reason 'No such file or directory'

wpeterman commented 4 years ago

Specify the full path, ending with a forward slash. write.dir <- "C:/Users/Gabriela/Documents/CutByLadera/Optimized/07042020/"

Bill Peterman Assistant Professor School of Environment and Natural Resources The Ohio State University 2021 Coffey Road Columbus, OH 43210-1085 Phone: 614.292.9795 Web Page https://goo.gl/4Gc15W Terrestrial Wildlife Ecology Lab http://www.twel.osu.edu

Bill Peterman

On Tue, Apr 7, 2020 at 9:33 PM AridaiHari notifications@github.com wrote:

Actually I tried the complete path but the error is still the same

CVM<-stack("C:/Users/Gabriela/Documents/CutByLadera/CVM_stack.tif") dir.create(file.path("C:/Users/Gabriela/Documents/CutByLadera/Optimized")) dir.create(file.path("C:/Users/Gabriela/Documents/CutByLadera/Optimized", "07042020"))

write.dir <- "C:/Users/Gabriela/Documents/CutByLadera/Optimized/07042020"

GA.inputs_All <- GA.prep(method = "AIC", ASCII.dir = CVM, Results.dir = write.dir, min.cat = 0, select.trans = list("A", NA , "A", "A", "A", "A", NA, "A", "A", "A", "A", "A"), parallel = 4)

Warning message: In dir.create(file.path(Results.DIR, "Plots")) : cannot create dir 'C:\Users\Gabriela\Documents\CutByLadera\Optimized\07042020Results\Plots', reason 'No such file or directory'

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/wpeterman/ResistanceGA/issues/12#issuecomment-610702174, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDLQUJ7GKQGHZZWUKKNHTLRLPH5JANCNFSM4MDNRFFQ .

AridaiHari commented 4 years ago

Thanks!!!! :) :)