Last active
September 22, 2015 00:20
-
-
Save odow/32bb5cde5c94f60d4886 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 AmplNLWriter | |
using JuMP | |
function foo(want_to_work) | |
a, b= 1, 0.8 | |
m = Model(solver=IpoptNLSolver(Dict{ASCIIString, Any}("print_level"=>1))) | |
@defVar(m, 0 <= x <= 1) | |
@defVar(m, 0 <= y <= 1) | |
if want_to_work | |
@addConstraint(m, x <= a * y * b) | |
else | |
@addNLConstraint(m, x <= a * y * b) | |
end | |
@setNLObjective(m, Max, x) | |
solve(m) | |
@show getValue(x) | |
@show a * getValue(y) * b | |
@assert getValue(x) <= a * getValue(y) * b + 1e-5 | |
end | |
println("This should work") | |
foo(true) | |
println("This should fail") | |
foo(false) | |
println("But neither did") |
This file contains hidden or 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
g3 1 1 0 | |
2 1 1 1 0 0 | |
0 0 | |
0 0 | |
0 0 0 | |
0 0 0 0 | |
0 0 0 0 0 | |
2 1 | |
0 0 | |
0 0 0 0 0 | |
C0 | |
n0 | |
O0 1 | |
n0 | |
d1 | |
0 0 | |
x2 | |
0 0.0 | |
1 0.0 | |
r | |
1 -0.0 | |
b | |
0 0.0 1.0 | |
0 0.0 1.0 | |
k1 | |
1 | |
J0 2 | |
0 1.0 | |
1 -0.8 | |
G0 1 | |
0 1.0 |
This file contains hidden or 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
g3 1 1 0 | |
2 1 1 1 0 0 | |
0 0 | |
0 0 | |
0 0 0 | |
0 0 0 0 | |
0 0 0 0 0 | |
2 1 | |
0 0 | |
0 0 0 0 0 | |
C0 | |
n0 | |
O0 1 | |
n0 | |
d1 | |
0 0 | |
x2 | |
0 0.0 | |
1 0.0 | |
r | |
1 0.0 | |
b | |
0 0.0 1.0 | |
0 0.0 1.0 | |
k1 | |
1 | |
J0 2 | |
0 1.0 | |
1 -1.0 | |
G0 1 | |
0 1.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also,
Ipopt.jl
passes both tests