Created
November 3, 2015 13:00
-
-
Save Ph0non/58a6cc76502d98405458 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using JuMP | |
using Cbc | |
m=Model(solver = CbcSolver()); | |
@defVar(m, 0 <= x[1:7] <= 10000, Int); | |
@setObjective(m, :Min, -x[1] -x[2] ); | |
@addConstraint(m, sum(x) == 10000); # <-- so looks the macro normally used | |
i = "Ni63 >= 60" | |
y = parse(i) | |
y.args[1] = :(x[[3]]) | |
y.args[3] *= 10000 | |
eval(Expr(:macrocall,symbol("@addConstraint"),esc(m),esc(y))) # <-- how to modify the macro itself with an expression? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment