Giter Club home page Giter Club logo

prioritizrutils's People

Contributors

jeffreyhanson avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prioritizrutils's Issues

Feedback

Hi all,

I've been working on the back-end for prioritizr (now in this repo) and I feel like it's now at the stage where it would be good to get some feed back on it.

It doesn't pass CRAN checks and haven't written a vignette yet, but all the examples run and the unit tests pass.

The main help pages describe how to initialize a problem, how to add an objective to it, how to specify what type of decision is made for each planning unit (eg. binary), how to add constraints to the problem (eg. blm stuff), and how to specify how the problem should be solved.

I've used the proto R package for creating classes (similar to what ggplot2 does) so I'm hoping it will be fairly easy for people to contribute more functionality to the package (eg. constraints). The source code for the add_*_decision functions contain some simple examples .

I haven't added the functionality to support data.frame inputs yet (as discussed in prioritizr/prioritizr#4), but it shouldn't be too tricky to implement it in the future.

Unexpected mutable behaviour

The current version of this package does not behave as expected. Adding constraints to an object will result in the same constraints being added to copies of the object.

Consider the following code:

p <- problem(sim_pu_polygons, sim_features)
p1 <- p %>% add_locked_in_constraint('locked_in')

At the moment, both p and p1 will have the locked in constraints added to them. This is clearly undesirable.

I'm not sure about what the best solution is.

One option is to implement a copy function, something like:

p <- problem(sim_pu_polygons, sim_features)
p1 <- copy(p) %>% add_locked_in_constraint('locked_in')

Or, instead of implementing all the classes as proto classes, use S3 or S4 classes for classes that don't need dynamic methods (ie. methods that can be defined at run-time, eg. the Parameter, ConservationProblem, etc classes), but keep the the proto classes for classes that need dynamic methods (eg. Target, Constraint, Objective) so that it is easy to add extra functionality to the package.

Any other ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.