Transportation Problem
The Solver
OperationsResearchModels.solve
— Methodsolve(t)
Arguments
a::TransportationProblem
: The problem in type of TransportationProblem
Output
TransportationResult
: The custom data type that holds problem, solution, and optimum cost.
Description
Solves a transportation problem given by an object of in type TransportationProblem
.
Example
julia> t = TransportationProblem(
[ 1 1 1 1;
2 2 2 2;
3 3 3 3],
[100, 100, 100, 100], # Demands
[100, 100, 100]) # Supplies
Transportation Problem:
Costs: [1 1 1 1; 2 2 2 2; 3 3 3 3]
Demand: [100, 100, 100, 100]
Supply: [100, 100, 100]
julia> isbalanced(t)
false
julia> result = solve(t)
Transportation Results:
Main problem:
Transportation Problem:
Costs: [1 1 1 1; 2 2 2 2; 3 3 3 3]
Demand: [100, 100, 100, 100]
Supply: [100, 100, 100]
Balanced problem:
Transportation Problem:
Costs: [1 1 1 1; 2 2 2 2; 3 3 3 3; 0 0 0 0]
Demand: [100, 100, 100, 100]
Supply: [100, 100, 100, 100]
Cost:
600.0
Solution:
[-0.0 -0.0 -0.0 100.0; 100.0 -0.0 -0.0 -0.0; -0.0 -0.0 100.0 -0.0; -0.0 100.0 -0.0 -0.0]
OperationsResearchModels.Transportation.TransportationProblem
— TypeTransportationProblem
Arguments
costs::Array{T,2}
: The cost matrix of the transportation problem.demand::Array{T,1}
: The demand vector of the transportation problem.supply::Array{T,1}
: The supply vector of the transportation problem.
Description
The TransportationProblem
struct represents a transportation problem with a cost matrix, demand vector, and supply vector.
OperationsResearchModels.Transportation.TransportationResult
— TypeTransportationResult(problem, balancedProblem, solution, cost)
Arguments
problem::TransportationProblem
: The original transportation problem.balancedProblem::TransportationProblem
: The balanced transportation problem.solution::Matrix
: The solution matrix of the transportation problem.cost::Real
: The optimal cost of the transportation problem.
Description
The TransportationResult
struct represents the result of solving a transportation problem. It contains the original problem, the balanced problem, the solution matrix, and the optimal cost.
Initial basic solutions for a transportation problem
North-west Corner Method
OperationsResearchModels.Transportation.northwestcorner
— Functionnorthwestcorner(a::TransportationProblem)::TransportationResult
Description
The northwest corner method is a heuristic for finding an initial basic feasible solution to a transportation problem. It starts at the northwest corner of the cost matrix and allocates as much as possible to the cell, then moves either down or right depending on whether the supply or demand has been met. The method continues until all supply and demand constraints are satisfied.
Arguments
a::TransportationProblem
: The problem in type of TransportationProblem
Output
TransportationResult
: The custom data type that holds problem, solution, and optimum cost.
The Least Cost Method
OperationsResearchModels.Transportation.leastcost
— Functionleastcost(a::TransportationProblem)::TransportationResult
Description
The least cost method is a heuristic for finding an initial basic feasible solution to a transportation problem. It starts by selecting the cell with the lowest cost and allocating as much as possible to that cell, then it moves to the next lowest cost cell and repeats the process until all supply and demand constraints are satisfied.
Arguments
a::TransportationProblem
: The problem in type of TransportationProblem
Output
TransportationResult
: The custom data type that holds problem, solution, and optimum cost.