いわて駐在研究日誌2。

NEVER STAND BEHIND ME

Dakotaの並列計算機能について(その3)

MOGAがやっぱり時間がかかるので、近似応答局面を導入した計算(Surrogate based optimization)の効率化を図ってみる。

テスト問題はBranin function(2D)で、3つの最小点がある。

f(-pi, 12.275)=f(pi,2.275)=f(9.42478,2.475)=0.397887

moga部分は共通で、以下のようなsettingとする。また、Surrogate作成のsamplingはLHS(samples=100)とした。

method
    id_method = 'MOGA'
    output silent
    max_function_evaluations = 5000
    moga
      fitness_type domination_count
      replacement_type below_limit = 6
        shrinkage_percentage = 0.9
      niching_type distance 0.05 0.05
      convergence_type metric_tracker
        percent_change = 0.05
        num_generations = 10
      postprocessor_type
        orthogonal_distance 0.05 0.05
      population_size = 300
      initialization_type unique_random
      crossover_type shuffle_random
        num_offspring = 2 num_parents = 2
        crossover_rate = 0.8
      mutation_type replace_uniform
        mutation_rate = 0.1
      seed = 531

① MOGAのみ(evaluation_concurrency = 4)

<<<<< Function evaluation summary: 1264 total (1264 new, 0 duplicate)
<<<<< Best parameters          =
                      9.4287956783e+00 x1
                      2.4366909952e+00 x2
<<<<< Best objective function  =
                      3.9970375654e-01
<<<<< Best data captured at function evaluation 1194


<<<<< Iterator moga completed.
<<<<< Environment execution completed.
DAKOTA execution time in seconds:
  Total CPU        =        0.9 [parent =   0.891864, child =   0.008136]
  Total wall clock =    70.9963

 

② MOGA+Surrogate(Kriging)(evaluation_concurrency = 4)

<<<<< Function evaluation summary (APPROX_INTERFACE): 6328 total (6328 new, 0 duplicate)
         obj_fn: 6328 val (6328 n, 0 d), 0 grad (0 n, 0 d), 0 Hess (0 n, 0 d)
<<<<< Function evaluation summary: 105 total (105 new, 0 duplicate)
         obj_fn: 105 val (105 n, 0 d), 0 grad (0 n, 0 d), 0 Hess (0 n, 0 d)
<<<<< Best parameters          =
                      9.3747568430e+00 x1
                      2.4445742729e+00 x2
<<<<< Best objective function  =
                      4.1002862086e-01
<<<<< Best data captured at function evaluation 105


<<<<< Iterator surrogate_based_global completed.
<<<<< Environment execution completed.
DAKOTA execution time in seconds:
  Total CPU        =       1.22 [parent =    1.22181, child =  -0.001814]
  Total wall clock =     8.5127

なんか精度がいまいちなので、LHS(samples=200)としてみる。

<<<<< Function evaluation summary (APPROX_INTERFACE): 6288 total (6288 new, 0 duplicate)
         obj_fn: 6288 val (6288 n, 0 d), 0 grad (0 n, 0 d), 0 Hess (0 n, 0 d)
<<<<< Function evaluation summary: 205 total (203 new, 2 duplicate)
         obj_fn: 205 val (203 n, 2 d), 0 grad (0 n, 0 d), 0 Hess (0 n, 0 d)
<<<<< Best parameters          =
                      9.4443335614e+00 x1
                      2.5037465699e+00 x2
<<<<< Best objective function  =
                      3.9987220558e-01
<<<<< Best data captured at function evaluation 205


<<<<< Iterator surrogate_based_global completed.
<<<<< Environment execution completed.
DAKOTA execution time in seconds:
  Total CPU        =       0.97 [parent =   0.963853, child =   0.006147]
  Total wall clock =    14.1147

 サンプル数が倍になったので、計算時間も倍になったが、精度はおおむねMOGAと同等になった。使ったinputファイルを上げておく。

branin_opt_sbo.in

# Dakota Input File: branin_opt_sbo.in
# moga + surrogate(kriging)

environment
    tabular_graphics_data
      tabular_graphics_file = 'branin_opt_sbo.dat'
    top_method_pointer = 'SBGO'

method
    id_method = 'SBGO'
    surrogate_based_global        
      model_pointer = 'SURROGATE'
      method_pointer = 'MOGA'
      replace_points
    max_iterations = 5
    output verbose

method
    id_method = 'MOGA'
    output silent
    max_function_evaluations = 5000
    moga
      fitness_type domination_count
      replacement_type below_limit = 6
        shrinkage_percentage = 0.9
      niching_type distance 0.05 0.05
      convergence_type metric_tracker
        percent_change = 0.05
        num_generations = 10
      postprocessor_type
        orthogonal_distance 0.05 0.05
      population_size = 300
      initialization_type unique_random
      crossover_type shuffle_random
        num_offspring = 2 num_parents = 2
        crossover_rate = 0.8
      mutation_type replace_uniform
        mutation_rate = 0.1
      seed = 531

model
    id_model = 'SURROGATE'
    surrogate global
      dace_method_pointer = 'SAMPLING'
      gaussian_process
        dakota

method
    id_method = 'SAMPLING'
    model_pointer = 'TRUTH'
    sampling
      sample_type lhs
      samples = 200
      seed = 12345

model
    id_model = 'TRUTH'
    single

variables
    continuous_design = 2
        initial_point      0     2    
        lower_bounds      -5     0     
        upper_bounds      10    15    
        descriptors      'x1'  'x2'  

interface
  fork
    asynchronous evaluation_concurrency = 4
  analysis_driver = 'simulator_script'
  parameters_file = 'params.in'
  results_file = 'results.out'
  work_directory directory_tag
    copy_files = 'templatedir/*'
  named 'workdir' file_save  directory_save
    aprepro

responses
    objective_functions = 1
    no_gradients
    no_hessians