Skip to content

Commit

Permalink
fix FactCheck for probabiistic descent
Browse files Browse the repository at this point in the history
  • Loading branch information
alyst committed Aug 4, 2015
1 parent 9dbd32d commit ba049c5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/test_direct_search_with_probabilistic_descent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@ facts("Random direction generator") do
rdg2 = BlackBoxOptim.RandomDirectionGen(10, 17)
ds2 = BlackBoxOptim.directions_for_k(rdg2, 1)
@fact size(ds2) => (10, 17)

end

facts("Mirrored random direction generator") do

mrdg1 = BlackBoxOptim.MirroredRandomDirectionGen(2, 4)
ds1 = BlackBoxOptim.directions_for_k(mrdg1, 1)
@fact size(ds1) => (2, 4)
@fact ds1[:,3] == -ds1[:,1] => true
@fact ds1[:,4] == -ds1[:,2] => true
@fact ds1[:,3] => -ds1[:,1]
@fact ds1[:,4] => -ds1[:,2]

mrdg2 = BlackBoxOptim.MirroredRandomDirectionGen(10, 6)
ds2 = BlackBoxOptim.directions_for_k(mrdg2, 1)
@fact size(ds2) => (10, 6)
@fact ds2[:,4] == -ds2[:,1] => true
@fact ds2[:,5] == -ds2[:,2] => true
@fact ds2[:,6] == -ds2[:,3] => true
@fact ds2[:,4] => -ds2[:,1]
@fact ds2[:,5] => -ds2[:,2]
@fact ds2[:,6] => -ds2[:,3]

# Must be even number of directions
@fact_throws BlackBoxOptim.MirroredRandomDirectionGen(10, 1)
@fact_throws BlackBoxOptim.MirroredRandomDirectionGen(10, 3)
@fact_throws BlackBoxOptim.MirroredRandomDirectionGen(10, 7)

end
end

0 comments on commit ba049c5

Please sign in to comment.