@@ -15,34 +15,26 @@ gem install alns
1515
1616## Exmaple
1717``` ruby
18- init_sol = NewMyProblemState .new
18+ solver = ALNS :: Solver .new
1919
20- select = ALNS ::NewRouletteWheel .new ([3 , 2 , 1 , 0.5 ], 0.8 , 2 , 2 )
21- accept = ALNS ::HillClimbing .new
22- stop = ALNS ::MaxIterations .new (100_000 )
23-
24- solver := ALNS ::Iterator .new
20+ init_sol = make_initial_solution(solver.rnd)
2521
2622solver.on_outcome do |outcome , cand |
23+ # do something
2724end
2825
2926solver.add_destroy_operator do |state , rnd |
30- # ...
31- end
32- solver.add_destroy_operator do |state , rnd |
33- # ...
27+ # do something
3428end
3529
3630solver.add_repair_operator do |state , rnd |
37- # ...
31+ # do something
3832end
3933
40- solver.add_repair_operator do | state , rnd |
41- # ...
42- end
34+ select = ALNS :: NewRouletteWheel . new ([ 3 , 2 , 1 , 0.5 ], 0.8 , 2 , 2 )
35+ accept = ALNS :: HillClimbing . new
36+ stop = ALNS :: MaxIterations . new ( 100_000 )
4337
4438result = alns.iterate(init_sol, select , accept, stop)
45- best = res.best_state
46-
47- # do something with the best solution..
39+ # do something with the result...
4840```
0 commit comments