-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
61 lines (52 loc) · 1.42 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package mps
import (
"github.com/skelterjohn/go.matrix"
)
const (
UNKNOWN int = iota
NAME
ROWS
COLUMNS
RHS
RANGES
BOUNDS
ENDDATA
)
type InequalityType int
const (
EQUALITY InequalityType = iota
LE
GE
)
type VarTrans func(float64, float64) float64
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 Constraint struct {
Name string
Type InequalityType
Coefficients map[string]float64
Rhs float64
}
var InequalityCode2InequalityType = map[string]InequalityType{
"E" : EQUALITY,
"G" : GE,
"L" : LE,
}
func defaultTransform(x_prime, x_prime2 float64) float64 {
return x_prime
}
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
}
const OBJECTIVE_CONST_TERM string = "const_term"