#! /usr/bin/env python
from waflib.Configure import conf
import sferes

def build(bld):
   uselib_ = 'TBB BOOST EIGEN PTHREAD MPI SDL OGLFT FREETYPE PNGWRITER'
   cxxflags_kdtree = bld.get_env()['CXXFLAGS', '-I.', '-DLIBSSRCKDTREE_HAVE_BOOST']

   if(False):
      sferes.create_variants(bld,
                             source = 'maze.cpp',
                             use = 'sferes2 fastsim',
                             target = '',
                             uselib = uselib_,
                             variants = ['GEN1 POP4 MANUAL'])
      
   if(False):
      sferes.create_variants(bld,
                             source = 'maze.cpp',
                             use = 'sferes2 fastsim',
                             target = '',
                             uselib = uselib_,
                             variants = ['JHDEBUG NSGA GEN1 POP4'])

   if(False):
      sferes.create_variants(bld,
                             source = 'maze.cpp',
                             use = 'sferes2 fastsim',
                             target = '',
                             uselib = uselib_,
                             variants = ['DBG JHDEBUG VISUALIZE NSGA GEN20 POP1000',
                                         'DBG JHDEBUG VISUALIZE NSGA GEN20 POP1000 DIV',
                                         'DBG JHDEBUG VISUALIZE CMOEA GEN20 POP1000 DIV',
                                         ])
   if(False):
      sferes.create_variants(bld,
                             source = 'maze.cpp',
                             use = 'sferes2 fastsim',
                             target = '',
                             uselib = uselib_,
                             variants = ['RLS JHDEBUG NSGA GEN=4 POP=4 DIV',
                                         'RLS JHDEBUG CMOEA GEN=4 POP=4 DIV',
                                         ])
      
   if(False):
      sferes.create_variants(bld,
                             source = 'maze.cpp',
                             use = 'sferes2 fastsim',
                             target = '',
                             uselib = uselib_,
                             variants = ['DBG JHDEBUG MANUAL NSGA GEN1 POP4 STPGOAL MULTIPLICATIVE_FITNESS'])

   if(False):
      sferes.create_variants(bld,
                             source = 'maze.cpp',
                             use = 'sferes2 fastsim',
                             target = '',
                             uselib = uselib_,
                             variants = ['DBG JHDEBUG CMOEA GEN=1 POP=4 FSTART MDIST',
                                         'RLS JHDEBUG CMOEA GEN=1 POP=4 FSTART MDIST'])

   # CMOEA Bin sampling debug settings
   if(False):
      sferes.create_variants(bld,
                             source = 'maze.cpp',
                             use = 'sferes2 fastsim',
                             target = '',
                             uselib = uselib_,
                             cxxflags = cxxflags_kdtree,
                             variants = ['DBG CMOEASAMP GEN=4 POP=4 BIN=4 BINS=8 MAZES=4 DIV STPGOAL OPQWALL MDIST NOEQPOP',
                                 'DBG CMOEASAMP GEN=4 POP=4 BIN=4 BINS=8 MAZES=4 DIV STPGOAL OPQWALL MDIST',
                                 'DBG CMOEASAMP GEN=4 POP=4 BIN=4 BINS=8 MAZES=4 DIV STPGOAL OPQWALL MDIST NOEQPOP NOMPI',
                                 'DBG CMOEASAMP GEN=4 POP=4 BIN=4 BINS=8 MAZES=4 DIV STPGOAL OPQWALL MDIST NOEQPOP NOMPISELECT',
                                 ])

   # Settings for visualizing the bin-sampling experiments.
   if(False):
      sferes.create_variants(bld,
                             source = 'maze.cpp',
                             use = 'sferes2 fastsim',
                             target = '',
                             uselib = uselib_,
                             cxxflags = cxxflags_kdtree,
                             variants = [
                                 'RLS CMOEASAMP GEN=4 POP=1000 BIN=10 BINS=1000 MAZES=100 DIV STPGOAL OPQWALL MDIST NOMPI VISUALIZE',
                                 'DBG CMOEASAMP GEN=4 POP=1000 BIN=10 BINS=1000 MAZES=100 DIV STPGOAL OPQWALL MDIST NOMPI',
                                 ])

   # Lexicase experiment
   if(False):
      sferes.create_variants(bld,
                             source = 'maze.cpp',
                             use = 'sferes2 fastsim',
                             target = '',
                             uselib = uselib_,
                             cxxflags = cxxflags_kdtree,
                             variants = ['DBG LEXICASE GEN=10 POP=8 BIN=10 BINS=1000 MAZES=10 STPGOAL OPQWALL MDIST NOEQPOP NPAT'])

   # Guided NSGA-II experiment
   if(True):
      sferes.create_variants(bld,
                             source = 'maze.cpp',
                             use = 'sferes2 fastsim',
                             target = '',
                             uselib = uselib_,
                             cxxflags = cxxflags_kdtree,
                             variants = ['RLS GNSGA GEN=1001 POP=1000 BIN=10 BINS=1000 MAZES=100 STPGOAL OPQWALL MDIST',
                                         'RLS GNSGA GEN=1001 POP=1000 BIN=10 BINS=1000 MAZES=100 STPGOAL OPQWALL MDIST VISUALIZE NOMPI',
                                         'RLS GNSGA GEN=1001 POP=1000 BIN=10 BINS=1000 MAZES=100 STPGOAL OPQWALL MDIST VISUALIZE NOMPI PNGW',
                                         ])
      
   # Load NSGA-III and e-Epsilon
   if(True):
      sferes.create_variants(bld,
                             source = 'maze.cpp',
                             use = 'sferes2 fastsim',
                             target = '',
                             uselib = uselib_,
                             cxxflags = cxxflags_kdtree,
                             variants = ['RLS MRV2 ELEXICASE GEN=1001 POP=1000 BIN=10 BINS=1000 MAZES=100 STPGOAL OPQWALL MDIST NPAT NPCO NOMPI',
                                         ])
