Exemple #1
0
Fichier : lp.go Projet : 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
}
Exemple #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
}
Exemple #3
0
Fichier : lp.go Projet : gaffo/golp
// NumCols returns the number of columns (variables) in the linear program.
// See http://lpsolve.sourceforge.net/5.5/get_Ncolumns.htm
func (l *LP) NumCols() int {
	return int(C.get_Ncolumns(l.ptr))
}