Example #1
0
File: lp.go Project: gaffo/golp
// Variables return the values for the variables of the solved linear program
// See http://lpsolve.sourceforge.net/5.5/get_variables.htm
func (l *LP) Variables() []float64 {
	numCols := int(C.get_Ncolumns(l.ptr))
	cRow := make([]C.double, numCols)
	C.get_variables(l.ptr, &cRow[0])
	row := make([]float64, numCols)
	for i := 0; i < numCols; i++ {
		row[i] = float64(cRow[i])
	}
	return row
}
Example #2
0
func (l *LP) Variables() []float64 {
	numCols := int(C.get_Ncolumns(l.ptr))
	row := make([]float64, numCols)
	C.get_variables(l.ptr, (*C.double)(&row[0]))
	return row
}