BenioffOceanInitiative/bbnj

boundary penalty results in failed presolve check

Opened this issue · 4 comments

Applied add_boundary_penalties( ) to scenario s01a.bio.rls.grp01.30pct.gl.now.mol50km and repeated analysis using a series of different penalty values. Any penalty value <= 0.00000000000000000001 successfully runs but produces no change in solution. Any penalty value above that threshold results in failed presolve_check( ).

penalty <= 0.00000000000000000001 (1e-20): no change in solution

see scenario s01a.bio.rls.blm.grp01.30pct.gl.now.mol50km

scenario with penalty = 0.00000000000000000001
scenario w blm

scenario with penalty = 0
scenario wo blm

penalty > 0.0000000000000000001 (1e-19): fails presolve check

Quitting from lines 46-105 (s01a.bio.rls.blmpsc.grp01.30pct.gl.now.mol50km.Rmd) 
Error in .local(a, b, ...) : 
  problem failed presolve checks. For more information see ?presolve_check
Calls: <Anonymous> ... eval -> solve_log -> <Anonymous> -> <Anonymous> -> .local
Error in stdout() : invalid connection
Calls: <Anonymous> ... close.txtProgressBar -> <Anonymous> -> cat -> stdout
Execution halted
bbest commented

Whoah, rescaling r_pu affects presolv_check and results!

range(r_pu): [0.0000000000000000001]
  [1] TRUE
range(r_pu): [0.0001,0.0001]
  Warning in presolve_check.OptimizationProblem(compile(x)) :
  planning units with (relatively) very high costs, note this may be a false positive
range(r_pu): [1,1]
  Warning in presolve_check.OptimizationProblem(compile(x)) :
  planning units with (relatively) very high costs, note this may be a false positive
[1] FALSE

@mvisalli also found rescaling input feature layers affected results.

Gameplan

So probably should:

  1. Rescale all layers [0,1] before including as input features.

  2. Determine an acceptable planning unit (r_pu) constant value (and perhaps range w/ fishing considerations).

  3. Then mess with parallelizing BLM values to test.

bbest commented

Note that now you can either skip prioritizr::presolve_check( ) or force to run despite errors, per prioritizr::solve() arguments now passed on from extra arguments in bbnj::solve_log():

# skip checks
tif <- solve_log(p, pfx, redo=redo, run_checks=F)
# OR run despite warnings
tif <- solve_log(p, pfx, redo=redo, force =F)

Having issue with rescaling raster stacks see issue #22

Rescaling all conservation features [0-1] changes solution

Rescaled scenario: 22.45% area

s01a.bio.rescale.now.mol50km.Rmd

Screen Shot 2019-08-13 at 10 41 12 AM

Scenario no rescaling: 23.67% area

s01a.bio.now.mol50km.Rmd

Screen Shot 2019-08-13 at 10 45 48 AM