optimus

package
v0.4.0-alpha2 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2018 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDegenerateVector = errors.New("all elements in the vector the same")
)

Functions

func SortOrders

func SortOrders(orders []WeightedOrder)

Types

type Clock

type Clock func() time.Time

Clock describes whatever that can return current time. Used primarily while testing.

type Config

type Config struct {
	PrivateKey   privateKey `yaml:"ethereum" json:"-"`
	Logging      logging.Config
	Workers      []auth.Addr
	Benchmarks   benchmarks.Config `yaml:"benchmarks"`
	Marketplace  marketplaceConfig
	Optimization optimizationConfig
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

type Consumer

type Consumer interface {
	LowerBound() []float64
	DeviceType() sonm.DeviceType
	DeviceBenchmark(id int) (*sonm.Benchmark, bool)
	SplittingAlgorithm() sonm.SplittingAlgorithm
	Result(criteria float64) interface{}
}

type DeviceManager

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

func (*DeviceManager) Consume

func (m *DeviceManager) Consume(benchmarks sonm.Benchmarks) (*sonm.AskPlanResources, error)

type MarketOrder

type MarketOrder = sonm.DWHOrder

type Model

type Model interface {
	Train(trainingSet [][]float64, expectation []float64) (TrainedModel, error)
}

type ModelConfig

type ModelConfig struct {
	Alpha          float64 `yaml:"alpha" default:"1e-3"`
	Regularization float64 `yaml:"regularization" default:"6.0"`
	MaxIterations  int     `yaml:"max_iterations" default:"1000"`
}

type Normalizer

type Normalizer interface {
	Normalize(x float64) float64
	NormalizeBatch(x []float64)
	Denormalize(x float64) float64
}

type Optimus

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

Watch for current worker's status. Collect its devices.

Worker MUST provide its network capabilities somehow.

Fetch all bids. Optimize matrix looking for price per each benchmark unit. Map each bid to functional price. Then by comparing the price with expected price we can see what's underestimated. Sort. Filter. Pick.

func NewOptimus

func NewOptimus(cfg Config, log *zap.Logger) (*Optimus, error)

func (*Optimus) Run

func (m *Optimus) Run(ctx context.Context) error

type OrderClassifier

type OrderClassifier interface {
	Classify(orders []*MarketOrder) ([]WeightedOrder, error)
}

TODO: Docs.

type OrderScanner

type OrderScanner interface {
	All(ctx context.Context) ([]*MarketOrder, error)
}

type TrainedModel

type TrainedModel interface {
	Predict(vec []float64) (float64, error)
}

type Watcher

type Watcher interface {
	OnRun()
	OnShutdown()
	Execute(ctx context.Context)
}

type WeightedOrder

type WeightedOrder struct {
	Order    *MarketOrder
	Distance float64
	Weight   float64
}

Jump to

Keyboard shortcuts

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