solver

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_TOLERANCE      = 1e-10
	DEFAULT_MAX_ITERATIONS = uint(1000000)
)

Variables

View Source
var ErrUnknown = errors.New("unknown solution")

ErrUnknown is used when a solution could not be found.

View Source
var WORKDIR = "/tmp/sls/solutions"

Functions

This section is empty.

Types

type CustomIdentifiers

type CustomIdentifiers map[string]interface{}

type Experiment

type Experiment struct {
	ID                   ExperimentID
	ExternalKey          *string
	Source               string
	MaxIterations        uint
	Tolerance            float64
	Identifier           ExperimentIdentifier
	IntegrationFunctions ExperimentIntegrationFunctions
	SolutionsScheduledAt *time.Time
	Solutions            *ExperimentSolutions
	CreatedAt            time.Time
}

type ExperimentID

type ExperimentID string

func NextExperimentID

func NextExperimentID() ExperimentID

type ExperimentIdentifier

type ExperimentIdentifier struct {
	Name      string
	From      float64
	To        float64
	Increment float64
}

type ExperimentInput

type ExperimentInput struct {
	ExternalKey   *string
	MaxIterations *uint
	Tolerance     *float64
	Source        string
	Identifier    ExperimentIdentifier
}

type ExperimentIntegrationFunction

type ExperimentIntegrationFunction struct {
	Label      string
	Expression string
}

type ExperimentIntegrationFunctions

type ExperimentIntegrationFunctions []ExperimentIntegrationFunction

type ExperimentRepository

type ExperimentRepository interface {
	Store(experiment *Experiment) error
	Find(id ExperimentID, externalKey *string) (*Experiment, error)
}

type ExperimentSolution

type ExperimentSolution struct {
	ID              SolutionID
	IdentifierValue float64
	Solution        *Solution `bson:"-"`
}

type ExperimentSolutions

type ExperimentSolutions []*ExperimentSolution

type IntegrationResult

type IntegrationResult struct {
	Label string  `json:"label"`
	Value float64 `json:"value"`
}

type IntegrationResults

type IntegrationResults []IntegrationResult

type Scheduler

type Scheduler interface {
	ScheduleSolution(*Solution) error
	ScheduleExperiment(*Experiment) error
}

type Service

type Service interface {
	ScheduleSolution(si *SolutionInput) (*Solution, error)
	Solve(id SolutionID) error
	FindSolution(id SolutionID, externalKey *string) (*Solution, error)
	ScheduleExperiment(ei *ExperimentInput) (*Experiment, error)
	ProcessExperiment(id ExperimentID) error
	FindExperiment(id ExperimentID, externalKey *string) (*Experiment, error)
}

func NewService

func NewService(solutions SolutionRepository, experiments ExperimentRepository, scheduler Scheduler, compiler compiler.Service) Service

type Solution

type Solution struct {
	ID                SolutionID
	ExternalKey       *string
	Source            string
	ModelHash         string
	CustomIdentifiers CustomIdentifiers
	MaxIterations     uint
	Tolerance         float64
	Errored           *bool
	Found             *bool
	Steps             *uint64
	ExecutionTime     *float64
	Results           *IntegrationResults
	CreatedAt         time.Time
	UpdatedAt         time.Time
	FinishedAt        *time.Time
}

type SolutionID

type SolutionID string

func NextSolutionID

func NextSolutionID() SolutionID

type SolutionInput

type SolutionInput struct {
	ExternalKey       *string
	MaxIterations     *uint
	Tolerance         *float64
	Source            string
	CustomIdentifiers CustomIdentifiers
}

type SolutionRepository

type SolutionRepository interface {
	Store(solution *Solution) error
	Find(id SolutionID, externalKey *string) (*Solution, error)
	FindForReuse(externalKey, modelHash string, maxIterations uint, tolerance float64) (*Solution, error)
}

Jump to

Keyboard shortcuts

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