Documentation ¶
Index ¶
Constants ¶
View Source
const ( // default EPSILON value for checking if a value is zero or not EPSILON = float64(1e-6) // default max iterations for optimizing the solution MAX_ITER = 100 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Problem ¶
type Problem struct {
// contains filtered or unexported fields
}
func CreateProblem ¶
Create a transportation problem from the given args.
supply, demand: positive float64 array/slice. costs: 2-D matrix, row size should match supply length, column size should match demand length. opts is for optional args: opts[0]: MAX_ITER, max iterations to run when optimizing the solution, default to 100. opts[1]: EPSILON, used to tell if a float64 value is zero or not, default to 1e-6. if you need to use a non-default EPSILON (opt[1]), you must also set MAX_ITER (opt[0]). returns the Problem{} struct.
func (*Problem) GetCostAndFlow ¶
Get the solution (both the total cost and the flow matrix), should be called after calling Solve().
Click to show internal directories.
Click to hide internal directories.