Roulette Wheel Strategy¶
Randomly select config for each iteration based on weights. Weights are updated depending on success.
RouletteWheelStrategy
¶
Bases: AdaptiveStrategy
Roulette-wheel strategy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logger
|
Logger
|
Logger for logging messages. |
required |
learning_rate
|
float
|
Learning rate used to update weights, 0 < learning_rate < 1. |
0.5
|
lex_weight
|
int
|
Weight used to convert lexicographic cost into integer cost. |
1000
|
converter
|
AutoDestructionConverter
|
Converter for computing destruction percentages of auto-mode destroy operators. |
LastImprovementDestructionConverter()
|
min_weight
|
float
|
Minimum value of weight. Defaults to 0.001. |
0.001
|
get_initial_config(config_catalog: ConfigCatalog, initial_model: Model) -> ActiveConfig
¶
Get initial LNS configuration using roulette wheel selection after initializing weights.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_catalog
|
ConfigCatalog
|
Config catalog. |
required |
initial_model
|
Model
|
Initial model. |
required |
Returns:
| Type | Description |
|---|---|
ActiveConfig
|
Active LNS configuration. |
update_config(active_config: ActiveConfig, config_catalog: ConfigCatalog, stats: list[dict[str, Any]], lns_object: LNS) -> ActiveConfig
¶
Update weight of current LNS configuration and select new LNS configuration using roulette wheel selection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
active_config
|
ActiveConfig
|
Current active LNS configuration. |
required |
config_catalog
|
ConfigCatalog
|
Full LNS configuration catalog. |
required |
stats
|
list[dict[str, Any]]
|
Statistics. |
required |
Returns:
| Type | Description |
|---|---|
ActiveConfig
|
New LNS configuration. |