Beispiel #1
0
func NewLP(rows, cols int) *LP {
	l := new(LP)
	l.ptr = C.make_lp(C.int(rows), C.int(cols))
	// Free the lp structure in the Go finalizer
	runtime.SetFinalizer(l, deleteLP)
	return l
}
Beispiel #2
0
Datei: lp.go Projekt: gaffo/golp
// NewLP create a new linear program structure with specified number of rows and
// columns. The underlying C data structure's memory will be freed in a Go
// finalizer, so there is no need to explicitly deallocate it.
func NewLP(rows, cols int) *LP {
	l := new(LP)
	l.ptr = C.make_lp(C.int(rows), C.int(cols))
	runtime.SetFinalizer(l, deleteLP)
	l.SetAddRowMode(true)
	l.SetVerboseLevel(IMPORTANT)
	return l
}