Skip to content

Commit

Permalink
Add :EPS test
Browse files Browse the repository at this point in the history
  • Loading branch information
anriseth committed Mar 1, 2016
1 parent 092a56d commit 6f4cb2b
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ facts("NBI optimisation") do
end

facts("WS optimisation") do
# TODO: do for EPS as well
m = MultiModel(solver = IpoptSolver(print_level=0))
@defVar(m, x[i=1:5])
@defNLExpr(m, f1, sum{x[i]^2, i=1:5})
Expand Down Expand Up @@ -79,6 +78,35 @@ facts("WS optimisation") do
@fact f2arr --> roughly(f2true, 1e-5)
end

facts("EPS optimisation") do
m = MultiModel(solver = IpoptSolver(print_level=0))
@defVar(m, x[i=1:5])
@defNLExpr(m, f1, sum{x[i]^2, i=1:5})
@defNLExpr(m, f2, 3x[1]+2x[2]-x[3]/3+0.01*(x[4]-x[5])^3)
@addNLConstraint(m, x[1]+2x[2]-x[3]-0.5x[4]+x[5]==2)
@addNLConstraint(m, 4x[1]-2x[2]+0.8x[3]+0.6x[4]+0.5x[5]^2 == 0)
@addNLConstraint(m, sum{x[i]^2, i=1:5} <= 10)

obj1 = SingleObjective(f1)
obj2 = SingleObjective(f2)

multim = getMultiData(m)
multim.objectives = [obj1, obj2]
multim.pointsperdim = 5
solve(m, method = :EPS)

f1arr = convert(Array{Float64},
[multim.paretofront[i][1] for i in 1:multim.pointsperdim])
f2arr = convert(Array{Float64},
[multim.paretofront[i][2] for i in 1:multim.pointsperdim])
f1true = [0.555081, 10.0, 7.63877, 5.27754, 2.91631]
f2true = [2.13057, -4.01115, -2.99356, -1.86918, -0.532781]

@fact f1arr --> roughly(f1true, 1e-5)
@fact f2arr --> roughly(f2true, 1e-5)
end




facts("TODO: Initial value test") do
Expand Down

0 comments on commit 6f4cb2b

Please sign in to comment.