Skip to content

Commit 77e201a

Browse files
bibengabibenga
authored andcommitted
updates readme
1 parent 32d6929 commit 77e201a

1 file changed

Lines changed: 9 additions & 17 deletions

File tree

README.md

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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

2622
solver.on_outcome do |outcome, cand|
23+
# do something
2724
end
2825

2926
solver.add_destroy_operator do |state, rnd|
30-
# ...
31-
end
32-
solver.add_destroy_operator do |state, rnd|
33-
# ...
27+
# do something
3428
end
3529

3630
solver.add_repair_operator do |state, rnd|
37-
# ...
31+
# do something
3832
end
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

4438
result = 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

Comments
 (0)