SimulatedAnnealingOptimizer<T>

Models & Types · AiDotNet.PromptEngineering.Optimization

Optimizer that uses simulated annealing to escape local optima.

Inheritance: PromptOptimizerBase<T> → SimulatedAnnealingOptimizer<T>

For Beginners

Like cooling metal - starts flexible, becomes rigid.

Example:

How it works:

  • High temperature: Accept many variations, even worse ones
  • Cooling down: Gradually become more selective
  • Low temperature: Only accept improvements (like greedy search)

Benefits:

  • Escapes local optima by exploring broadly
  • Proven effective for combinatorial optimization
  • Balances exploration and exploitation

How It Works

Simulated annealing occasionally accepts worse solutions early in the search (when “temperature” is high), allowing exploration of the solution space. As temperature decreases, it becomes more greedy.

Constructors

Constructor Summary
SimulatedAnnealingOptimizer(double initialTemperature, double coolingRate, double minTemperature, int? seed) Initializes a new instance of the SimulatedAnnealingOptimizer class.