Exemplo n.º 1
0
Arquivo: lp.go Projeto: 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
}
Exemplo n.º 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
}