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

Locked in/out constraints ignored with proportion-type decisions #58

Closed
jeffreyhanson opened this Issue Feb 4, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@jeffreyhanson
Copy link
Contributor

jeffreyhanson commented Feb 4, 2018

The add_locked_in_constraints and add_locked_out_constraints are ignored when using proportion type decisions. Below is a reproducible example,

library(prioritizr)
data(sim_pu_polygons, sim_features)
s <- problem(sim_pu_polygons, sim_features, "cost") %>%
  add_min_set_objective() %>%
  add_relative_targets(0.1) %>%
  add_proportion_decisions() %>%
  add_locked_in_constraints("locked_in") %>%
  add_default_solver(time_limit = 5) %>%
  solve()

# check that the solution obeys constraints as expected
expect_true(all(s$solution_1[which(sim_pu_polygons$locked_in)] == 1))
# > Error: all(s$solution_1[which(sim_pu_polygons$locked_in)] == 1) isn't true.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment