simulated annealing CLI changeable

master
Bel LaPointe 2022-09-20 15:56:54 -06:00
parent 2914c64fda
commit 582ee7a0d2
2 changed files with 8 additions and 1 deletions

View File

@ -15,6 +15,9 @@ def main():
ap.add_argument("--max-keys-down", default=2, type=int)
ap.add_argument("--startup", default=3, type=int)
ap.add_argument("--controller-setup", default=False, action="store_true")
ap.add_argument("--simulated-annealing-initial-health", default=50, type=int)
ap.add_argument("--simulated-annealing-nothing-penalty", default=100, type=int)
ap.add_argument("--simulated-annealing-decay-rate", default=5, type=int)
ap.add_argument("--translation", default=json.dumps({
"up": {"key": "w", "weight": 20},
"down": {"key": "s", "weight": 1},
@ -23,6 +26,10 @@ def main():
}))
args = ap.parse_args()
writer.LineChooserSimulatedAnnealing.initial_health = args.simulated_annealing_initial_health
writer.LineChooserSimulatedAnnealing.nothing_penalty = args.simulated_annealing_nothing_penalty
writer.LineChooserSimulatedAnnealing.decay_rate = args.simulated_annealing_decay_rate
w_translation = json.loads(args.translation) if args.translation else None
w = writer.Writer(writer.PyAutoGUIWriter(w_translation))

View File

@ -103,7 +103,7 @@ class LineChooserLatestSticky(LineChooser):
class LineChooserSimulatedAnnealing(LineChooser):
initial_health = 50
nothing_penalty = 10
nothing_penalty = 100
decay_rate = 5
def _choose(self, latest, oldest):