solution

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractValueOfVariable

func ExtractValueOfVariable(s Solution, v symbolic.Variable) (float64, error)

func ExtractValueOfVariableWithID

func ExtractValueOfVariableWithID(s Solution, idx uint64) (float64, error)

func FindValueOfExpression

func FindValueOfExpression(s Solution, expr symbolic.Expression) (symbolic.Expression, error)

FindValueOfExpression evaluates a symbolic expression using the values from a solution. It substitutes all variables in the expression with their values from the solution and returns the resulting symbolic expression (typically a constant).

func GetOptimalObjectiveValue added in v0.6.4

func GetOptimalObjectiveValue(sol Solution) (float64, error)

GetOptimalObjectiveValue evaluates the objective function of an optimization problem at the solution point. It uses the FindValueOfExpression function to compute the value of the objective expression using the variable values from the solution.

Types

type DummySolution

type DummySolution struct {
	Values map[uint64]float64

	// The objective for the solution
	Objective float64

	// Whether or not the solution is within the optimality threshold
	Status solution_status.SolutionStatus

	// The optimization problem that this solution is for
	Problem *problem.OptimizationProblem
}

func (*DummySolution) GetOptimalValue

func (ds *DummySolution) GetOptimalValue() float64

func (*DummySolution) GetProblem added in v0.6.4

func (ds *DummySolution) GetProblem() *problem.OptimizationProblem

func (*DummySolution) GetStatus

func (*DummySolution) GetValueMap

func (ds *DummySolution) GetValueMap() map[uint64]float64

type Solution

type Solution interface {
	GetOptimalValue() float64
	GetValueMap() map[uint64]float64

	// GetStatus
	//
	GetStatus() solution_status.SolutionStatus

	// GetProblem returns the optimization problem that this solution is for
	GetProblem() *problem.OptimizationProblem
}

Solution stores the solution of an optimization problem and associated metadata

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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