optimizer

package
v0.0.0-...-8b14664 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultOptimizerWindowCap   = 10
	DefaultOptimizerWarmupTicks = 2 * DefaultOptimizerWindowCap
	DefaultQueueSoftThreshold   = 1000.0
	DefaultQueuePenaltyWeight   = 1.5
	DefaultLatencyPenaltyWeight = 0.3
	DefaultQueuePenaltyClamp    = -2.0
	DefaultRewardClamp          = 2.0
	DefaultSafetyConsumeRatio   = 0.7
	DefaultLogEveryTicks        = 20

	DefaultMinApplyInterval    = 2_000_000_000 // 2s in nanoseconds (time.Duration)
	DefaultErrorPenaltyWeight  = 2.0
	DefaultErrorPenaltyThresh  = 0.01
	DefaultEmergencyRollbackDR = 0.5
	DefaultEmergencyRollbackN  = 2
)

Variables

This section is empty.

Functions

func ClipAction

func ClipAction(current, delta, min, max float64) float64

func Denormalize

func Denormalize(norm, min, max float64) float64

func Normalize

func Normalize(val, min, max float64) float64

Types

type DDPG

type DDPG struct {
	// contains filtered or unexported fields
}

DDPG implements Deep Deterministic Policy Gradient. Actor: state → action (tanh); Critic: (state, action) → Q-value.

func NewDDPG

func NewDDPG(stateSize, actionSize int, lr float64, batchSize int) *DDPG

func (*DDPG) Act

func (d *DDPG) Act(state []float64) []float64

func (*DDPG) ResetNoise

func (d *DDPG) ResetNoise()

func (*DDPG) SetNoiseDecay

func (d *DDPG) SetNoiseDecay(decay, floor float64)

func (*DDPG) Store

func (d *DDPG) Store(state, action []float64, reward float64, nextState []float64, done bool)

func (*DDPG) Train

func (d *DDPG) Train(batchSize int)

type Optimizer

type Optimizer struct {
	// contains filtered or unexported fields
}

Optimizer runs the DDPG training loop on Lasso-selected broker parameters.

func NewOptimizer

func NewOptimizer(b *broker.Broker, params []TunableParam, optCfg OptimizerConfig, pilot ...PilotData) *Optimizer

func (*Optimizer) Start

func (o *Optimizer) Start()

func (*Optimizer) Stop

func (o *Optimizer) Stop()

type OptimizerConfig

type OptimizerConfig struct {
	Interval     time.Duration
	BatchSize    int
	WarmupTicks  int
	LearningRate float64
	Hysteresis   float64
	NoiseDecay   float64 // per-step multiplicative decay for OUNoise sigma (default 0.999)
	NoiseFloor   float64 // minimum sigma value (default 0.05)
}

func DefaultOptimizerConfig

func DefaultOptimizerConfig() OptimizerConfig

type PilotData

type PilotData struct {
	Configs     [][]float64 // each row: one config vector (len == NumTunableParams)
	Throughputs []float64   // observed throughput per config
	Alpha       float64     // L1 regularisation strength
}

PilotData holds results from pilot runs used for Lasso calibration.

type TunableParam

type TunableParam struct {
	Name   string
	Min    float64
	Max    float64
	Weight float64 // Lasso-derived importance (0 = excluded from DDPG action space)
}

func ActiveParams

func ActiveParams(all []TunableParam) []TunableParam

func CalibrateWeights

func CalibrateWeights(params []TunableParam, configs [][]float64, throughputs []float64, alpha float64) []TunableParam

CalibrateWeights runs Lasso regression on pilot run data to determine which parameters actually affect throughput. Params with zero Lasso weight are excluded from the DDPG action space, reducing dimensionality.

configs: matrix of pilot configurations (each row = one run, len(row) == len(params)) throughputs: observed throughput for each pilot config alpha: L1 regularisation strength (higher => more parameters zeroed out)

func DefaultTunableParams

func DefaultTunableParams() []TunableParam

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL