Comments (5)
I like this idea Jeff!
Personally, I like the first approach of adding a parameter. Maybe instead of blended
we could add hierarchical
and set it to FALSE
by default?
This way current code would still work as the behavior wouldn't change. At least I think so. Would it break existing code to add another parameter like this?
I don't think users would be too confused as long as the documentation explains things well. Maybe I'm off though. Would be great to get some feedback from users on this too.
from prioritizr.
Yeah, I agree the first approach has its benefits. For example, (1) we don't need to introduce a new family of functions, (2) we don't need to update the print()
method for problem()
objects to accomodate a new family of functions, (3) it provides an easy way for users to play around with hierachical optimization, and (4) it reduces the conceptual load/burden for using the package (e.g., users don't have to learn about "penalties" vs. "${something else}" for blended vs. hierachical optimization, and instead users only need to think about "penalties" and if they should be optimized using blended vs. hierachical approaches).
One other thing to think about is that we might want to also add a parameter to allow the optimization process to degrade the primary/main objective by a relative amount. E.g., you might havbe a main objective of minimizing cost and a secondary objective of minimizing boundary length. In some cases, you might not want to accept any degradation (meaning that you want to reduce boundary length as much as possible, but don't make it any more costly). In other cases, you might want to accept a small amount of degredation (meaning that you want to reduce boundary length as much as possible, and you're happy for the cost to increase slightly [e.g. 5%]). So, if we wanted to add this, we would need to add an extra parameter too - so I don't know if/how that would influence our choice of API?
from prioritizr.
Great points!
Interesting idea about the additional parameter. I think that's a good idea and I don't think it influences the choice of API at least for me.
What about you?
from prioritizr.
Yeah, I worry that such a function could be confusing, because some parameters would only have an effect when other parameters are NULL
or TRUE
/FALSE
. E.g., at the moment we have this as a function definition
add_boundary_penalties(
x,
penalty,
edge_factor = rep(0.5, number_of_zones(x),
zones = diag(number_of_zones(x)),
data = NULL
)
This would turn into something like (where reltol
and hierachical
are new parameters for hierachical optimization). Note that zones
and daa
parameters are always last for consistency with other functions in prioritizr.
add_boundary_penalties(
x,
penalty,
edge_factor = rep(0.5, number_of_zones(x),
reltol = NULL,
hierachical = FALSE,
zones = diag(number_of_zones(x)),
data = NULL,
)
So, to use blended optimization, it would be the same as usual, e.g.:
p %>% add_boundary_penalties(penalty = 0.001)
And for hierachical optimization, it would be something like this:
p %>% add_boundary_penalties(penalty = NULL, reltol = 0.05, hierachicial = TRUE)
If we had the hierachical stuff in a different family of functions, then it would look something like this instead:
# blended
p %>% add_boundary_b_penalties(penalty = 0.001)
# hierachical
p %>% add_boundary_h_penalties(reltol = 0.05)
However, I'm not 100% happy with _h_
and _b_
penalty types, because add_asym_connectivity_penalties()
is already long enough, and I would prefer not to make this function name even longer.
from prioritizr.
Hmmm, the way you describe things here makes me reconsider my initial preference. Given the potential for confusion of the approach to keep the functions and adding parameters, I am now favoring the _h_
and _b_
approach.
Its still hard to say how much appetite for the _h_
functions is out there though. I have no idea about that one.
from prioritizr.
Related Issues (20)
- Error solving problem HOT 6
- please change check in `add_manual_locked_constraints()` HOT 10
- Assertion on 'log_to_console' failed: Must be of type 'logical', not 'integer'. HOT 3
- rij_matrix can return empty matrix when memory = TRUE HOT 2
- installation of cplexAPI package + re-scaling features data HOT 17
- Overly zealous assert causes spurious failure on problem(), breaking valid prioritizr 7.1.1 scripts HOT 2
- high boundary penalties, but solution has weird hole HOT 1
- Error while solving the problem HOT 10
- package overview manual entry
- Add linear constraints for multiple zones HOT 3
- Add max area threshold for zone and dealing with fragmented zones HOT 25
- Improve presolve checks HOT 1
- ℹ In argument to `x`. Caused by `problems(pu, features = multi_layer)` HOT 7
- write_problem() doesn't work
- Categorical `SpatRaster` layers break problem creation HOT 4
- Ph.D. HOT 2
- How should I incorporate a risk layer? Penalty, feature, feature weight? HOT 7
- Add proximity-based metrics for irreplaceability
- Cost in problems with zones HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prioritizr.