Comments (6)
Sounds like a good idea. How would that api look exactly? Pass in a lazyeval object or a character string?
from ompr.
I think you want something like this:
setGeneric("set_objective", function(model, expression, direction = "max") {
set_objective_(model, expression = lazyeval::lazy(expression), direction = direction)
}
setGeneric("set_objective_", function(model, expression, direction = "max") {
# As the current set_objective fn, but without calls to substitute
}
expression
can be passed to set_objective_
as a formula, string, or quote
d expression.
BTW, if direction
can only be "min" or "max", then you can check it by changing the signature to
function(model, expression, direction = c("max", "min"))
then calling direction <- match.arg(direction)
in the function body.
from ompr.
Cool thanks. Will look into this. Indeed, maybe I should use lazyeval instead of base R's eval/substitute constructs.
from ompr.
@richierocks Added a first version. If you have any comments on the code or other ideas let me know
from ompr.
I close the issue for now.
from ompr.
Still needs a solution for variable and constraint quantifiers
from ompr.
Related Issues (20)
- "Error: You have definied variables for 1 rows, but you add a constant with N elements" HOT 1
- NEOS Server & Async Mode: Error: object of type 'closure' is not subsettable
- Gurobi Solver- Recent Experience? HOT 1
- Binary variable <= Binary matrix: Error in constraint$lhs - constraint$rhs : non-numeric argument to binary operator HOT 4
- Solver log not showing up anymore
- Semi continuous variable HOT 7
- Feature Request Integrated with RAMPL HOT 1
- Feature Request: GAMS presolver for ompr HOT 1
- Error in add_variable, object not found HOT 1
- Object not found HOT 3
- Release ompr 1.0.3
- Getting error "*.AbstractLinearFunction" when multiplying in objective function HOT 1
- the cannery problem - vignette enhancement
- Again, my curious interest is in pre-processing sparse data objects outside of MIPModel if possible. I created a simple sparse supply chain dataframe as an example:
- Feature Request: adding "macro" functionality to ompr HOT 1
- Sparse Matrix Constraints with multi-index
- Limiting Variable Definition By Ordered Pair HOT 9
- How write a constraint once there is a variable used as the index? HOT 2
- interactions: "Quadratic expression are not supported" HOT 3
- Request Feature: Add Vectorized semantics revisited of MILPModel to MIPModel
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 ompr.