mps

package module
v0.0.0-...-a88c119 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2015 License: GPL-3.0 Imports: 10 Imported by: 0

README

MPS

Mathematical Programming System (MPS) format parser for Golang. This package reads a plain/gzip mps file and returns the linear programming problem in standard form represented as the following matrices :

  1. A, constraints coefficient matrix.
  2. b, column vector containing the RHS of constraints.
  3. c, column vector containing objective function coefficients.

It also returns the functions that map from variables used in the standard form to the the actual variables of the problem.

This package depends on go.matrix

GoDoc

Documentation

Index

Constants

View Source
const (
	UNKNOWN int = iota
	NAME
	ROWS
	COLUMNS
	RHS
	RANGES
	BOUNDS
	ENDDATA
)
View Source
const OBJECTIVE_CONST_TERM string = "const_term"

Variables

View Source
var InequalityCode2InequalityType = map[string]InequalityType{
	"E": EQUALITY,
	"G": GE,
	"L": LE,
}

Functions

func WriteMPS

func WriteMPS(lp *LPData, fname string) error

Types

type Constraint

type Constraint struct {
	Name         string
	Type         InequalityType
	Coefficients map[string]float64
	Rhs          float64
}

type InequalityType

type InequalityType int
const (
	EQUALITY InequalityType = iota
	LE
	GE
)

type LPData

type LPData struct {
	Name          string
	A             matrix.MatrixRO     // Constriant coeff matrix
	B             matrix.MatrixRO     // RHS of constriants in std form
	C             matrix.MatrixRO     // Variable coeffs in objective function
	CConst        float64             // Constant term in objective function
	Orig2UsedVars map[string][]int    // key = orig var name, value = slice of actually used var index
	OrigVarsMap   map[string]VarTrans // key = orig var name, value = function(actual vars) returning orig var
}

func ParseCompressedMPS

func ParseCompressedMPS(fname string) (*LPData, error)

func ParseMPS

func ParseMPS(fname string) (*LPData, error)

type LPRaw

type LPRaw struct {
	Name               string
	Variables          map[string][]string
	VariableTransforms map[string]VarTrans
	Constraints        map[string]*Constraint // Var bounds are to be included as a constraint
	Objective          map[string]float64
}

type VarTrans

type VarTrans func(float64, float64) float64

Jump to

Keyboard shortcuts

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