model

package
v0.0.0-...-0c4d5fd Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Featol = 1.0e-6

The feasibility tolerance to check whether constraints are satisfied

View Source
var Plinfy = 1.0e10

A placeholder for +/-Inf for finite calculations

Functions

This section is empty.

Types

type Constraint

type Constraint struct {
	Name      string
	Sense     ConstraintSense
	Shape     Shape
	Min       float64
	Max       float64
	Variables []Variable
	Index     int
	// contains filtered or unexported fields
}

func (Constraint) Gradient

func (c Constraint) Gradient(x []float64) ([]float64, error)

Get the gradient of the constraint at a given point. Returns a nil slice and an error if AMPL is unable to compute the gradient

func (Constraint) IsSatisfied

func (c Constraint) IsSatisfied(value float64) bool

Returns a bool for whether or not the given value (as computed by `Value`) satisfies this constraint

func (Constraint) String

func (c Constraint) String() string

func (Constraint) Value

func (c Constraint) Value(x []float64) (float64, error)

Get the value of the constraint at a given point. Returns an error if AMPL is unable to compute the value

type ConstraintSense

type ConstraintSense int
const (
	ConstraintGreaterThan ConstraintSense = iota
	ConstraintLessThan
	ConstraintEqualTo
	ConstraintRange
	ConstraintNonBinding
)

func (ConstraintSense) String

func (t ConstraintSense) String() string

type Objective

type Objective struct {
	Name      string
	Sense     ObjectiveSense
	Shape     Shape
	Variables []Variable
	Index     int
	// contains filtered or unexported fields
}

Represents a single objective in the problem

func (Objective) Gradient

func (o Objective) Gradient(x []float64) ([]float64, error)

Compute the gradient of this objective at the given point

func (Objective) String

func (o Objective) String() string

func (Objective) Value

func (o Objective) Value(x []float64) (float64, error)

Compute the LHS of this objective at the given point

type ObjectiveSense

type ObjectiveSense int
const (
	ObjectiveMin ObjectiveSense = 0
	ObjectiveMax ObjectiveSense = 1
)

func (ObjectiveSense) String

func (s ObjectiveSense) String() string

type Problem

type Problem struct {
	Name string
	// contains filtered or unexported fields
}

func ProblemFromFile

func ProblemFromFile(path string) *Problem

Load a problem from a `.nl` file

func (*Problem) ConstraintJacobian

func (p *Problem) ConstraintJacobian(x []float64) ([]float64, error)

Evaluate the Jacobian of the constraints

func (*Problem) ConstraintValues

func (p *Problem) ConstraintValues(x []float64) ([]float64, error)

Evaluate the value of all constraints at point x

func (*Problem) Constraints

func (p *Problem) Constraints() []Constraint

Get the list of Constraints in this problem

func (*Problem) Objectives

func (p *Problem) Objectives() []Objective

Get the list of Objectives in this problem

func (*Problem) Variables

func (p *Problem) Variables() []Variable

Get the list of Variables in this problem

type Shape

type Shape int
const (
	Constant Shape = iota
	Linear
	Quadratic
	NonLinear
)

func (Shape) String

func (c Shape) String() string

type Variable

type Variable struct {
	Name       string
	Type       VariableType
	LowerBound float64
	UpperBound float64
	Index      int
}

func (Variable) String

func (v Variable) String() string

type VariableType

type VariableType int
const (
	VariableReal VariableType = iota
	VariableInteger
	VariableBinary
	VariableArc
)

func (VariableType) String

func (t VariableType) String() string

Jump to

Keyboard shortcuts

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