tests/testthat/test_paretoFront.R

context("paretoFront")

testParetoFront = function(name, in.dim, out.dim, ...) {
  test_that(name, {
    f = generateMOO(name, in.dim, out.dim, ...)
    pf = getParetoFront(f, 100)
    
    if (is.null(attributes(f)$paretoFront)) {
      expect_equal(pf, matrix(NA_real_, ncol = getOutDim(f), nrow = 0L))
    } else {
      if (name %in% c("uf5", "cf1")) {
        expect_message(getParetoFront(f, 100), "has discret")
      } else {
        expect_equal(dim(pf), c(100, out.dim))
      }
      expect_true(all(!is_dominated(t(pf))))
    }
    
  })
}

testParetoFront("zdt1", in.dim = 2L, out.dim = 2L)
testParetoFront("zdt2", in.dim = 2L, out.dim = 2L)
testParetoFront("zdt3", in.dim = 2L, out.dim = 2L)
testParetoFront("zdt4", in.dim = 2L, out.dim = 2L)
testParetoFront("zdt5", in.dim = 2L, out.dim = 2L)
testParetoFront("zdt6", in.dim = 2L, out.dim = 2L)

testParetoFront("dtlz1", in.dim = 2L, out.dim = 2L)
testParetoFront("dtlz2", in.dim = 2L, out.dim = 2L)
testParetoFront("dtlz3", in.dim = 2L, out.dim = 2L)
testParetoFront("dtlz4", in.dim = 2L, out.dim = 2L)
testParetoFront("dtlz5", in.dim = 2L, out.dim = 2L)
testParetoFront("dtlz6", in.dim = 2L, out.dim = 2L)
#testParetoFront("dtlz7", in.dim = 2L, out.dim = 2L)

testParetoFront("lz1", in.dim = 3L, out.dim = 2L)
testParetoFront("lz2", in.dim = 3L, out.dim = 2L)
testParetoFront("lz3", in.dim = 3L, out.dim = 2L) 
testParetoFront("lz4", in.dim = 3L, out.dim = 2L)
testParetoFront("lz5", in.dim = 3L, out.dim = 2L)
testParetoFront("lz6", in.dim = 5L, out.dim = 3L)
testParetoFront("lz7", in.dim = 3L, out.dim = 2L) 
testParetoFront("lz8", in.dim = 3L, out.dim = 2L)
testParetoFront("lz9", in.dim = 3L, out.dim = 2L)

testParetoFront("uf1", in.dim = 3L, out.dim = 2L)
testParetoFront("uf2", in.dim = 3L, out.dim = 2L)
testParetoFront("uf3", in.dim = 3L, out.dim = 2L)
testParetoFront("uf4", in.dim = 3L, out.dim = 2L)
testParetoFront("uf5", in.dim = 3L, out.dim = 2L)
testParetoFront("uf6", in.dim = 3L, out.dim = 2L)
testParetoFront("uf7", in.dim = 3L, out.dim = 2L)
testParetoFront("uf8", in.dim = 5L, out.dim = 3L)
testParetoFront("uf9", in.dim = 5L, out.dim = 3L)
testParetoFront("uf10", in.dim = 5L, out.dim = 3L)

testParetoFront("cf1", in.dim = 3L, out.dim = 2L)
testParetoFront("cf2", in.dim = 3L, out.dim = 2L)
testParetoFront("cf3", in.dim = 3L, out.dim = 2L)
testParetoFront("cf4", in.dim = 3L, out.dim = 2L)
testParetoFront("cf5", in.dim = 3L, out.dim = 2L)
testParetoFront("cf6", in.dim = 4L, out.dim = 2L)
testParetoFront("cf7", in.dim = 4L, out.dim = 2L)
testParetoFront("cf8", in.dim = 5L, out.dim = 3L)
testParetoFront("cf9", in.dim = 5L, out.dim = 3L)
testParetoFront("cf10", in.dim = 5L, out.dim = 3L)

testParetoFront("wfg1", in.dim = 5L, out.dim = 2L, k = 3L)
testParetoFront("wfg2", in.dim = 5L, out.dim = 2L, k = 3L)
testParetoFront("wfg3", in.dim = 5L, out.dim = 2L, k = 3L)
testParetoFront("wfg4", in.dim = 5L, out.dim = 2L, k = 3L)
testParetoFront("wfg5", in.dim = 5L, out.dim = 2L, k = 3L)
testParetoFront("wfg6", in.dim = 5L, out.dim = 2L, k = 3L)
testParetoFront("wfg7", in.dim = 5L, out.dim = 2L, k = 3L)
testParetoFront("wfg8", in.dim = 5L, out.dim = 2L, k = 3L)
testParetoFront("wfg9", in.dim = 5L, out.dim = 2L, k = 3L)

testParetoFront("mop1", in.dim = 1L, out.dim = 2L)
testParetoFront("mop2", in.dim = 2L, out.dim = 2L)
testParetoFront("mop3", in.dim = 2L, out.dim = 2L)
testParetoFront("mop4", in.dim = 3L, out.dim = 2L)
testParetoFront("mop5", in.dim = 2L, out.dim = 3L)
testParetoFront("mop6", in.dim = 2L, out.dim = 2L)
testParetoFront("mop7", in.dim = 2L, out.dim = 3L)
testParetoFront("mop_c1", in.dim = 2L, out.dim = 2L)
testParetoFront("mop_c2", in.dim = 6L, out.dim = 2L)
testParetoFront("mop_c3", in.dim = 2L, out.dim = 3L)

testParetoFront("bk1", in.dim = 2L, out.dim = 2L)
testParetoFront("dgo1", in.dim = 1L, out.dim = 2L)
testParetoFront("dgo2", in.dim = 1L, out.dim = 2L)
testParetoFront("fa1", in.dim = 3L, out.dim = 3L)
testParetoFront("far1", in.dim = 2L, out.dim = 2L)
testParetoFront("fes1", in.dim = 2L, out.dim = 2L)
testParetoFront("fes2", in.dim = 2L, out.dim = 3L)
testParetoFront("fes3", in.dim = 2L, out.dim = 4L)
testParetoFront("ff1", in.dim = 2L, out.dim = 2L)
testParetoFront("ikk1", in.dim = 2L, out.dim = 3L)
testParetoFront("im1", in.dim = 2L, out.dim = 2L)
testParetoFront("jos1", in.dim = 2L, out.dim = 2L)
testParetoFront("jos2", in.dim = 2L, out.dim = 2L)
testParetoFront("kur1", in.dim = 2L, out.dim = 2L)
testParetoFront("lrs1", in.dim = 2L, out.dim = 2L)
testParetoFront("ltdz1", in.dim = 3L, out.dim = 3L)
testParetoFront("le1", in.dim = 2L, out.dim = 2L)
testParetoFront("mhhm1", in.dim = 1L, out.dim = 3L)
testParetoFront("mhhm2", in.dim = 2L, out.dim = 3L)
testParetoFront("mlf1", in.dim = 1L, out.dim = 2L)
testParetoFront("mlf2", in.dim = 2L, out.dim = 2L)
testParetoFront("qv1", in.dim = 2L, out.dim = 2L)
testParetoFront("sch1", in.dim = 1L, out.dim = 2L)
testParetoFront("sp1", in.dim = 2L, out.dim = 2L)
testParetoFront("ssfyy1", in.dim = 2L, out.dim = 2L)
testParetoFront("ssfyy2", in.dim = 1L, out.dim = 2L)
testParetoFront("sk1", in.dim = 1L, out.dim = 2L)
testParetoFront("sk2", in.dim = 4L, out.dim = 2L)
testParetoFront("tkly1", in.dim = 4L, out.dim = 2L)
testParetoFront("vu1", in.dim = 2L, out.dim = 2L)
testParetoFront("vu2", in.dim = 2L, out.dim = 2L)
testParetoFront("vfm1", in.dim = 2L, out.dim = 3L)
testParetoFront("zlt1", in.dim = 2L, out.dim = 2L)
danielhorn/moobench documentation built on May 14, 2019, 4:04 p.m.