diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 116b9d8..a0b42ae 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2024-04-23T17:54:29","documenter_version":"1.4.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2024-04-29T17:52:15","documenter_version":"1.4.0"}} \ No newline at end of file diff --git a/dev/algorithms/index.html b/dev/algorithms/index.html index 48937ca..669f05c 100644 --- a/dev/algorithms/index.html +++ b/dev/algorithms/index.html @@ -1,5 +1,5 @@ -Algorithms · OperationsResearchModels.jl

Algorithms

Assignment Problem

OperationsResearchModels.solveMethod
solve(a)

Arguments

a::AssignmentProblem: The problem in type of AssignmentProblem

Output

AssignmentResult: The custom data type that holds problem, solution, and optimum cost.

Description

Solves an assignment problem given by an object of in type AssignmentProblem.

Example

julia> mat = [
+Algorithms · OperationsResearchModels.jl

Algorithms

Assignment Problem

OperationsResearchModels.solveMethod
solve(a)

Arguments

a::AssignmentProblem: The problem in type of AssignmentProblem

Output

AssignmentResult: The custom data type that holds problem, solution, and optimum cost.

Description

Solves an assignment problem given by an object of in type AssignmentProblem.

Example

julia> mat = [
                    4 8 1;
                    3 1 9;
                    1 6 7;
@@ -18,7 +18,7 @@
 
 julia> result.cost
 
-3.0
source

Transportation Problem

OperationsResearchModels.solveMethod
solve(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(
+3.0
source

Transportation Problem

OperationsResearchModels.solveMethod
solve(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], 
@@ -49,7 +49,7 @@
 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]
source

Shortest Path and Maximum Flow

solve(c::Vector{Connection}; problem::Union{::ShortestPathProblem, ::MaximumFlowProblem} = ShortestPathProblem)

Arguments

  • c::Vector{Connection}: Vector of connections
  • problem: Type of problem. Either ShortestPathProblem or MaximumFlowProblem

Example

julia> conns = [
+[-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]
source

Shortest Path and Maximum Flow

solve(c::Vector{Connection}; problem::Union{::ShortestPathProblem, ::MaximumFlowProblem} = ShortestPathProblem)

Arguments

  • c::Vector{Connection}: Vector of connections
  • problem: Type of problem. Either ShortestPathProblem or MaximumFlowProblem

Example

julia> conns = [
                    Connection(1, 2, 3),
                    Connection(1, 3, 2),
                    Connection(1, 4, 4),
@@ -104,7 +104,7 @@
  21
 
  julia> result.objective
- 11.531012240599605
source
OperationsResearchModels.PMedian.pmedian_with_distancesFunction
pmedian_with_distances(distancematrix, ncenters)

Arguments

  • distancematrix::Matrix: n x n matrix of distances
  • ncenters::Int: Number of centers

Description

  • ncenters locations are selected that minimizes the total distances to the nearest rows.

Output

  • PMedianResult: PMedianResult object.
source

Minimum Spanning Tree

OperationsResearchModels.MinimumSpanningTree.mstFunction
mst(connections)

Arguments

  • connections::Vector{Connection}: Vector of Connections

Description

Obtains the minimum spanning tree.

Output

  • ::MstResult: A MstResult object that holds the results.

Examples

julia> conns = Connection[
+ 11.531012240599605
source
OperationsResearchModels.PMedian.pmedian_with_distancesFunction
pmedian_with_distances(distancematrix, ncenters)

Arguments

  • distancematrix::Matrix: n x n matrix of distances
  • ncenters::Int: Number of centers

Description

  • ncenters locations are selected that minimizes the total distances to the nearest rows.

Output

  • PMedianResult: PMedianResult object.
source

Minimum Spanning Tree

OperationsResearchModels.MinimumSpanningTree.mstFunction
mst(connections)

Arguments

  • connections::Vector{Connection}: Vector of Connections

Description

Obtains the minimum spanning tree.

Output

  • ::MstResult: A MstResult object that holds the results.

Examples

julia> conns = Connection[
                        Connection(1, 2, 10),
                        Connection(2, 3, 10),
                        Connection(3, 4, 10),
@@ -127,7 +127,7 @@
  3-element Vector{Connection}:
   Connection(3, 4, 10, "x34")
   Connection(1, 4, 10, "x14")
-  Connection(2, 3, 10, "x23")
source

CPM (Critical Path Method)

OperationsResearchModels.CPM.cpmFunction
cpm(activities)

Arguments

  • activities::Vector{CpmActivity}

Output

  • ::CpmResult: The object holds the results

Description

Calculates CPM (Critical Path Method) and reports the critical path for a given set of activities.

Example

julia> A = CpmActivity("A", 2);
+  Connection(2, 3, 10, "x23")
source

CPM (Critical Path Method)

OperationsResearchModels.CPM.cpmFunction
cpm(activities)

Arguments

  • activities::Vector{CpmActivity}

Output

  • ::CpmResult: The object holds the results

Description

Calculates CPM (Critical Path Method) and reports the critical path for a given set of activities.

Example

julia> A = CpmActivity("A", 2);
 julia> B = CpmActivity("B", 3);
 julia> C = CpmActivity("C", 2, [A]);
 julia> D = CpmActivity("D", 3, [B]);
@@ -150,7 +150,7 @@
  "I"
 
  julia> result.path == [B, E, G, I]
-true
source

PERT (Project Evalutation and Review Technique)

PERT (Project Evalutation and Review Technique)

OperationsResearchModels.CPM.pertFunction
pert(activities)

Arguments

  • activities::Vector{PertActivity}: Vector of Pert Activities.

Example

julia> A = PertActivity("A", 1, 2, 3)
 PertActivity("A", 1.0, 2.0, 3.0, PertActivity[])
 
 julia> B = PertActivity("B", 3, 3, 3)
@@ -172,4 +172,4 @@
 8.0
 
 julia> result.stddev
-0.0
source
+0.0source

Knapsack

OperationsResearchModels.Knapsack.knapsackFunction
knapsack(values, weights, capacity)

Description

Solves the knapsack problem.

Arguments

  • values::Vector{Float64}: Values of items.
  • weights::Vector{Float64}: Weights of items.
  • capacity::Float64: Capacity of the knapsack.

Output

  • KnapsackResult: The custom data type that holds selected items, model, and objective value.
source
diff --git a/dev/index.html b/dev/index.html index 34b7787..8ccd75d 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -- · OperationsResearchModels.jl

Operations Research Models

The OperationsResearchModels package includes basic Operations Research subjects such as Transportation Problem, Assignment Problem, Minimum Spanning Tree, Shortest Path, Maximum Flow, and p-medians method for selecting location of facilities.

Package content is incrementaly updated.

Please refer the Algorithms section for the detailed documentation.

+- · OperationsResearchModels.jl

Operations Research Models

The OperationsResearchModels package includes basic Operations Research subjects such as Transportation Problem, Assignment Problem, Minimum Spanning Tree, Shortest Path, Maximum Flow, and p-medians method for selecting location of facilities.

Package content is incrementaly updated.

Please refer the Algorithms section for the detailed documentation.

diff --git a/dev/objects.inv b/dev/objects.inv index d867356..33db8be 100644 Binary files a/dev/objects.inv and b/dev/objects.inv differ diff --git a/dev/search_index.js b/dev/search_index.js index bd96c74..8c84710 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"#Operations-Research-Models","page":"-","title":"Operations Research Models","text":"","category":"section"},{"location":"","page":"-","title":"-","text":"The OperationsResearchModels package includes basic Operations Research subjects such as Transportation Problem, Assignment Problem, Minimum Spanning Tree, Shortest Path, Maximum Flow, and p-medians method for selecting location of facilities. ","category":"page"},{"location":"","page":"-","title":"-","text":"Package content is incrementaly updated.","category":"page"},{"location":"","page":"-","title":"-","text":"Please refer the Algorithms section for the detailed documentation. ","category":"page"},{"location":"algorithms/#Algorithms","page":"Algorithms","title":"Algorithms","text":"","category":"section"},{"location":"algorithms/#Assignment-Problem","page":"Algorithms","title":"Assignment Problem","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"OperationsResearchModels.solve(a::AssignmentProblem)","category":"page"},{"location":"algorithms/#OperationsResearchModels.solve-Tuple{AssignmentProblem}","page":"Algorithms","title":"OperationsResearchModels.solve","text":"solve(a)\n\nArguments\n\na::AssignmentProblem: The problem in type of AssignmentProblem\n\nOutput\n\nAssignmentResult: The custom data type that holds problem, solution, and optimum cost. \n\nDescription\n\nSolves an assignment problem given by an object of in type AssignmentProblem.\n\nExample\n\njulia> mat = [\n 4 8 1;\n 3 1 9;\n 1 6 7;\n ];\n\njulia> problem = AssignmentProblem(mat);\n\njulia> result = solve(problem);\n\njulia> result.solution\n\n3×3 Matrix{Float64}:\n 0.0 0.0 1.0\n 0.0 1.0 0.0\n 1.0 0.0 0.0\n\njulia> result.cost\n\n3.0\n\n\n\n\n\n","category":"method"},{"location":"algorithms/#Transportation-Problem","page":"Algorithms","title":"Transportation Problem","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"OperationsResearchModels.solve(t::TransportationProblem)","category":"page"},{"location":"algorithms/#OperationsResearchModels.solve-Tuple{TransportationProblem}","page":"Algorithms","title":"OperationsResearchModels.solve","text":"solve(t)\n\nArguments\n\na::TransportationProblem: The problem in type of TransportationProblem\n\nOutput\n\nTransportationResult: The custom data type that holds problem, solution, and optimum cost. \n\nDescription\n\nSolves a transportation problem given by an object of in type TransportationProblem.\n\nExample\n\njulia> t = TransportationProblem(\n [ 1 1 1 1; \n 2 2 2 2; \n 3 3 3 3], \n [100, 100, 100, 100], # Demands \n [100, 100, 100]) # Supplies \nTransportation Problem:\nCosts: [1 1 1 1; 2 2 2 2; 3 3 3 3]\nDemand: [100, 100, 100, 100]\nSupply: [100, 100, 100]\n\njulia> isbalanced(t)\nfalse\n\njulia> result = solve(t)\nTransportation Results:\nMain problem:\nTransportation Problem:\nCosts: [1 1 1 1; 2 2 2 2; 3 3 3 3]\nDemand: [100, 100, 100, 100]\nSupply: [100, 100, 100]\n\nBalanced problem:\nTransportation Problem:\nCosts: [1 1 1 1; 2 2 2 2; 3 3 3 3; 0 0 0 0]\nDemand: [100, 100, 100, 100]\nSupply: [100, 100, 100, 100]\n\nCost:\n600.0\nSolution:\n[-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]\n\n\n\n\n\n","category":"method"},{"location":"algorithms/#Shortest-Path-and-Maximum-Flow","page":"Algorithms","title":"Shortest Path and Maximum Flow","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"solve(c::Vector{Connection}; problem::Union{::ShortestPathProblem, ::MaximumFlowProblem} = ShortestPathProblem)","category":"page"},{"location":"algorithms/#Arguments","page":"Algorithms","title":"Arguments","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"c::Vector{Connection}: Vector of connections \nproblem: Type of problem. Either ShortestPathProblem or MaximumFlowProblem","category":"page"},{"location":"algorithms/#Example","page":"Algorithms","title":"Example","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"julia> conns = [\n Connection(1, 2, 3),\n Connection(1, 3, 2),\n Connection(1, 4, 4),\n Connection(2, 5, 3),\n Connection(3, 5, 1),\n Connection(3, 6, 1),\n Connection(4, 6, 2),\n Connection(5, 7, 6),\n Connection(6, 7, 5),\n ];\n\njulia> solve(conns, problem = ShortestPathProblem);\n\njulia> result.path\n3-element Vector{Connection}:\n Connection(1, 3, 2, \"x13\")\n Connection(3, 6, 1, \"x36\")\n Connection(6, 7, 5, \"x67\")\n\njulia> result.cost\n8.0\n\njulia> result = solve(conns, problem = MaximumFlowProblem);\n\njulia> result.path\n9-element Vector{Connection}:\n Connection(1, 2, 3.0, \"x12\")\n Connection(1, 3, 2.0, \"x13\")\n Connection(1, 4, 2.0, \"x14\")\n Connection(2, 5, 3.0, \"x25\")\n Connection(3, 5, 1.0, \"x35\")\n Connection(3, 6, 1.0, \"x36\")\n Connection(4, 6, 2.0, \"x46\")\n Connection(5, 7, 4.0, \"x57\")\n Connection(6, 7, 3.0, \"x67\")\n\njulia> result.flow\n7.0","category":"page"},{"location":"algorithms/#pmedian","page":"Algorithms","title":"pmedian","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"OperationsResearchModels.pmedian","category":"page"},{"location":"algorithms/#OperationsResearchModels.PMedian.pmedian","page":"Algorithms","title":"OperationsResearchModels.PMedian.pmedian","text":"pmedian(data, ncenters)\n\nArguments\n\ndata::Matrix: Coordinates of locations \nncenters::Int: Number of centers \n\nDescription\n\nThe function calculates Euclidean distances between all possible rows of the matrix data. ncenters locations are then selected that minimizes the total distances to the nearest rows. \n\nOutput\n\nPMedianResult: PMedianResult object. \n\nExample\n\njulia> data1 = rand(10, 2);\n\njulia> data2 = rand(10, 2) .+ 50;\n\njulia> data3 = rand(10, 2) .+ 100;\n\njulia> data = vcat(data1, data2, data3);\n\njulia> result = pmedian(data, 3);\n\njulia> result.centers\n3-element Vector{Int64}:\n 1\n 16\n 21\n\n julia> result.objective\n 11.531012240599605\n\n\n\n\n\n","category":"function"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"OperationsResearchModels.pmedian_with_distances","category":"page"},{"location":"algorithms/#OperationsResearchModels.PMedian.pmedian_with_distances","page":"Algorithms","title":"OperationsResearchModels.PMedian.pmedian_with_distances","text":"pmedian_with_distances(distancematrix, ncenters)\n\nArguments\n\ndistancematrix::Matrix: n x n matrix of distances\nncenters::Int: Number of centers \n\nDescription\n\nncenters locations are selected that minimizes the total distances to the nearest rows. \n\nOutput\n\nPMedianResult: PMedianResult object. \n\n\n\n\n\n","category":"function"},{"location":"algorithms/#Minimum-Spanning-Tree","page":"Algorithms","title":"Minimum Spanning Tree","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"OperationsResearchModels.mst","category":"page"},{"location":"algorithms/#OperationsResearchModels.MinimumSpanningTree.mst","page":"Algorithms","title":"OperationsResearchModels.MinimumSpanningTree.mst","text":"mst(connections)\n\nArguments\n\nconnections::Vector{Connection}: Vector of Connections \n\nDescription\n\nObtains the minimum spanning tree. \n\nOutput\n\n::MstResult: A MstResult object that holds the results. \n\nExamples\n\njulia> conns = Connection[\n Connection(1, 2, 10),\n Connection(2, 3, 10),\n Connection(3, 4, 10),\n Connection(1, 4, 10)\n ]\n\n4-element Vector{Connection}:\n Connection(1, 2, 10, \"x12\")\n Connection(2, 3, 10, \"x23\")\n Connection(3, 4, 10, \"x34\")\n Connection(1, 4, 10, \"x14\")\n\n julia> result = mst(conns)\n MstResult(Connection[Connection(3, 4, 10, \"x34\"), Connection(1, 4, 10, \"x14\"), Connection(2, 3, 10, \"x23\")], 30.0)\n \n julia> result.distance\n 30.0\n \n julia> result.connections\n 3-element Vector{Connection}:\n Connection(3, 4, 10, \"x34\")\n Connection(1, 4, 10, \"x14\")\n Connection(2, 3, 10, \"x23\")\n\n\n\n\n\n","category":"function"},{"location":"algorithms/#CPM-(Critical-Path-Method)","page":"Algorithms","title":"CPM (Critical Path Method)","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"OperationsResearchModels.cpm","category":"page"},{"location":"algorithms/#OperationsResearchModels.CPM.cpm","page":"Algorithms","title":"OperationsResearchModels.CPM.cpm","text":"cpm(activities)\n\nArguments\n\nactivities::Vector{CpmActivity}\n\nOutput\n\n::CpmResult: The object holds the results \n\nDescription\n\nCalculates CPM (Critical Path Method) and reports the critical path for a given set of activities. \n\nExample\n\njulia> A = CpmActivity(\"A\", 2);\njulia> B = CpmActivity(\"B\", 3);\njulia> C = CpmActivity(\"C\", 2, [A]);\njulia> D = CpmActivity(\"D\", 3, [B]);\njulia> E = CpmActivity(\"E\", 2, [B]);\njulia> F = CpmActivity(\"F\", 3, [C, D]);\njulia> G = CpmActivity(\"G\", 7, [E]);\njulia> H = CpmActivity(\"H\", 5, [E]);\njulia> I = CpmActivity(\"I\", 6, [G, F]);\njulia> J = CpmActivity(\"J\", 2, [C, D]);\n\njulia> activities = [A, B, C, D, E, F, G, H, I, J];\n\njulia> result = cpm(activities);\n\njulia> result.pathstr\n4-element Vector{String}:\n \"B\"\n \"E\"\n \"G\"\n \"I\"\n\n julia> result.path == [B, E, G, I]\ntrue\n\n\n\n\n\n","category":"function"},{"location":"algorithms/#PERT-(Project-Evalutation-and-Review-Technique)","page":"Algorithms","title":"PERT (Project Evalutation and Review Technique)","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"OperationsResearchModels.pert","category":"page"},{"location":"algorithms/#OperationsResearchModels.CPM.pert","page":"Algorithms","title":"OperationsResearchModels.CPM.pert","text":"pert(activities)\n\nArguments\n\nactivities::Vector{PertActivity}: Vector of Pert Activities. \n\nExample\n\njulia> A = PertActivity(\"A\", 1, 2, 3)\nPertActivity(\"A\", 1.0, 2.0, 3.0, PertActivity[])\n\njulia> B = PertActivity(\"B\", 3, 3, 3)\nPertActivity(\"B\", 3.0, 3.0, 3.0, PertActivity[])\n\njulia> C = PertActivity(\"C\", 5, 5, 5, [A, B])\nPertActivity(\"C\", 5.0, 5.0, 5.0, PertActivity[PertActivity(\"A\", 1.0, 2.0, 3.0, PertActivity[]), PertActivity(\"B\", 3.0, 3.0, 3.0, PertActivity[])])\n\njulia> activities = [A, B, C]\n3-element Vector{PertActivity}:\n PertActivity(\"A\", 1.0, 2.0, 3.0, PertActivity[])\n PertActivity(\"B\", 3.0, 3.0, 3.0, PertActivity[])\n PertActivity(\"C\", 5.0, 5.0, 5.0, PertActivity[PertActivity(\"A\", 1.0, 2.0, 3.0, PertActivity[]), PertActivity(\"B\", 3.0, 3.0, 3.0, PertActivity[])])\n\njulia> result = pert(activities)\nPertResult(PertActivity[PertActivity(\"B\", 3.0, 3.0, 3.0, PertActivity[]), PertActivity(\"C\", 5.0, 5.0, 5.0, PertActivity[PertActivity(\"A\", 1.0, 2.0, 3.0, PertActivity[]), PertActivity(\"B\", 3.0, 3.0, 3.0, PertActivity[])])], 8.0, 0.0)\n\njulia> result.mean\n8.0\n\njulia> result.stddev\n0.0\n\n\n\n\n\n","category":"function"}] +[{"location":"#Operations-Research-Models","page":"-","title":"Operations Research Models","text":"","category":"section"},{"location":"","page":"-","title":"-","text":"The OperationsResearchModels package includes basic Operations Research subjects such as Transportation Problem, Assignment Problem, Minimum Spanning Tree, Shortest Path, Maximum Flow, and p-medians method for selecting location of facilities. ","category":"page"},{"location":"","page":"-","title":"-","text":"Package content is incrementaly updated.","category":"page"},{"location":"","page":"-","title":"-","text":"Please refer the Algorithms section for the detailed documentation. ","category":"page"},{"location":"algorithms/#Algorithms","page":"Algorithms","title":"Algorithms","text":"","category":"section"},{"location":"algorithms/#Assignment-Problem","page":"Algorithms","title":"Assignment Problem","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"OperationsResearchModels.solve(a::AssignmentProblem)","category":"page"},{"location":"algorithms/#OperationsResearchModels.solve-Tuple{AssignmentProblem}","page":"Algorithms","title":"OperationsResearchModels.solve","text":"solve(a)\n\nArguments\n\na::AssignmentProblem: The problem in type of AssignmentProblem\n\nOutput\n\nAssignmentResult: The custom data type that holds problem, solution, and optimum cost. \n\nDescription\n\nSolves an assignment problem given by an object of in type AssignmentProblem.\n\nExample\n\njulia> mat = [\n 4 8 1;\n 3 1 9;\n 1 6 7;\n ];\n\njulia> problem = AssignmentProblem(mat);\n\njulia> result = solve(problem);\n\njulia> result.solution\n\n3×3 Matrix{Float64}:\n 0.0 0.0 1.0\n 0.0 1.0 0.0\n 1.0 0.0 0.0\n\njulia> result.cost\n\n3.0\n\n\n\n\n\n","category":"method"},{"location":"algorithms/#Transportation-Problem","page":"Algorithms","title":"Transportation Problem","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"OperationsResearchModels.solve(t::TransportationProblem)","category":"page"},{"location":"algorithms/#OperationsResearchModels.solve-Tuple{TransportationProblem}","page":"Algorithms","title":"OperationsResearchModels.solve","text":"solve(t)\n\nArguments\n\na::TransportationProblem: The problem in type of TransportationProblem\n\nOutput\n\nTransportationResult: The custom data type that holds problem, solution, and optimum cost. \n\nDescription\n\nSolves a transportation problem given by an object of in type TransportationProblem.\n\nExample\n\njulia> t = TransportationProblem(\n [ 1 1 1 1; \n 2 2 2 2; \n 3 3 3 3], \n [100, 100, 100, 100], # Demands \n [100, 100, 100]) # Supplies \nTransportation Problem:\nCosts: [1 1 1 1; 2 2 2 2; 3 3 3 3]\nDemand: [100, 100, 100, 100]\nSupply: [100, 100, 100]\n\njulia> isbalanced(t)\nfalse\n\njulia> result = solve(t)\nTransportation Results:\nMain problem:\nTransportation Problem:\nCosts: [1 1 1 1; 2 2 2 2; 3 3 3 3]\nDemand: [100, 100, 100, 100]\nSupply: [100, 100, 100]\n\nBalanced problem:\nTransportation Problem:\nCosts: [1 1 1 1; 2 2 2 2; 3 3 3 3; 0 0 0 0]\nDemand: [100, 100, 100, 100]\nSupply: [100, 100, 100, 100]\n\nCost:\n600.0\nSolution:\n[-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]\n\n\n\n\n\n","category":"method"},{"location":"algorithms/#Shortest-Path-and-Maximum-Flow","page":"Algorithms","title":"Shortest Path and Maximum Flow","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"solve(c::Vector{Connection}; problem::Union{::ShortestPathProblem, ::MaximumFlowProblem} = ShortestPathProblem)","category":"page"},{"location":"algorithms/#Arguments","page":"Algorithms","title":"Arguments","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"c::Vector{Connection}: Vector of connections \nproblem: Type of problem. Either ShortestPathProblem or MaximumFlowProblem","category":"page"},{"location":"algorithms/#Example","page":"Algorithms","title":"Example","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"julia> conns = [\n Connection(1, 2, 3),\n Connection(1, 3, 2),\n Connection(1, 4, 4),\n Connection(2, 5, 3),\n Connection(3, 5, 1),\n Connection(3, 6, 1),\n Connection(4, 6, 2),\n Connection(5, 7, 6),\n Connection(6, 7, 5),\n ];\n\njulia> solve(conns, problem = ShortestPathProblem);\n\njulia> result.path\n3-element Vector{Connection}:\n Connection(1, 3, 2, \"x13\")\n Connection(3, 6, 1, \"x36\")\n Connection(6, 7, 5, \"x67\")\n\njulia> result.cost\n8.0\n\njulia> result = solve(conns, problem = MaximumFlowProblem);\n\njulia> result.path\n9-element Vector{Connection}:\n Connection(1, 2, 3.0, \"x12\")\n Connection(1, 3, 2.0, \"x13\")\n Connection(1, 4, 2.0, \"x14\")\n Connection(2, 5, 3.0, \"x25\")\n Connection(3, 5, 1.0, \"x35\")\n Connection(3, 6, 1.0, \"x36\")\n Connection(4, 6, 2.0, \"x46\")\n Connection(5, 7, 4.0, \"x57\")\n Connection(6, 7, 3.0, \"x67\")\n\njulia> result.flow\n7.0","category":"page"},{"location":"algorithms/#pmedian","page":"Algorithms","title":"pmedian","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"OperationsResearchModels.pmedian","category":"page"},{"location":"algorithms/#OperationsResearchModels.PMedian.pmedian","page":"Algorithms","title":"OperationsResearchModels.PMedian.pmedian","text":"pmedian(data, ncenters)\n\nArguments\n\ndata::Matrix: Coordinates of locations \nncenters::Int: Number of centers \n\nDescription\n\nThe function calculates Euclidean distances between all possible rows of the matrix data. ncenters locations are then selected that minimizes the total distances to the nearest rows. \n\nOutput\n\nPMedianResult: PMedianResult object. \n\nExample\n\njulia> data1 = rand(10, 2);\n\njulia> data2 = rand(10, 2) .+ 50;\n\njulia> data3 = rand(10, 2) .+ 100;\n\njulia> data = vcat(data1, data2, data3);\n\njulia> result = pmedian(data, 3);\n\njulia> result.centers\n3-element Vector{Int64}:\n 1\n 16\n 21\n\n julia> result.objective\n 11.531012240599605\n\n\n\n\n\n","category":"function"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"OperationsResearchModels.pmedian_with_distances","category":"page"},{"location":"algorithms/#OperationsResearchModels.PMedian.pmedian_with_distances","page":"Algorithms","title":"OperationsResearchModels.PMedian.pmedian_with_distances","text":"pmedian_with_distances(distancematrix, ncenters)\n\nArguments\n\ndistancematrix::Matrix: n x n matrix of distances\nncenters::Int: Number of centers \n\nDescription\n\nncenters locations are selected that minimizes the total distances to the nearest rows. \n\nOutput\n\nPMedianResult: PMedianResult object. \n\n\n\n\n\n","category":"function"},{"location":"algorithms/#Minimum-Spanning-Tree","page":"Algorithms","title":"Minimum Spanning Tree","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"OperationsResearchModels.mst","category":"page"},{"location":"algorithms/#OperationsResearchModels.MinimumSpanningTree.mst","page":"Algorithms","title":"OperationsResearchModels.MinimumSpanningTree.mst","text":"mst(connections)\n\nArguments\n\nconnections::Vector{Connection}: Vector of Connections \n\nDescription\n\nObtains the minimum spanning tree. \n\nOutput\n\n::MstResult: A MstResult object that holds the results. \n\nExamples\n\njulia> conns = Connection[\n Connection(1, 2, 10),\n Connection(2, 3, 10),\n Connection(3, 4, 10),\n Connection(1, 4, 10)\n ]\n\n4-element Vector{Connection}:\n Connection(1, 2, 10, \"x12\")\n Connection(2, 3, 10, \"x23\")\n Connection(3, 4, 10, \"x34\")\n Connection(1, 4, 10, \"x14\")\n\n julia> result = mst(conns)\n MstResult(Connection[Connection(3, 4, 10, \"x34\"), Connection(1, 4, 10, \"x14\"), Connection(2, 3, 10, \"x23\")], 30.0)\n \n julia> result.distance\n 30.0\n \n julia> result.connections\n 3-element Vector{Connection}:\n Connection(3, 4, 10, \"x34\")\n Connection(1, 4, 10, \"x14\")\n Connection(2, 3, 10, \"x23\")\n\n\n\n\n\n","category":"function"},{"location":"algorithms/#CPM-(Critical-Path-Method)","page":"Algorithms","title":"CPM (Critical Path Method)","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"OperationsResearchModels.cpm","category":"page"},{"location":"algorithms/#OperationsResearchModels.CPM.cpm","page":"Algorithms","title":"OperationsResearchModels.CPM.cpm","text":"cpm(activities)\n\nArguments\n\nactivities::Vector{CpmActivity}\n\nOutput\n\n::CpmResult: The object holds the results \n\nDescription\n\nCalculates CPM (Critical Path Method) and reports the critical path for a given set of activities. \n\nExample\n\njulia> A = CpmActivity(\"A\", 2);\njulia> B = CpmActivity(\"B\", 3);\njulia> C = CpmActivity(\"C\", 2, [A]);\njulia> D = CpmActivity(\"D\", 3, [B]);\njulia> E = CpmActivity(\"E\", 2, [B]);\njulia> F = CpmActivity(\"F\", 3, [C, D]);\njulia> G = CpmActivity(\"G\", 7, [E]);\njulia> H = CpmActivity(\"H\", 5, [E]);\njulia> I = CpmActivity(\"I\", 6, [G, F]);\njulia> J = CpmActivity(\"J\", 2, [C, D]);\n\njulia> activities = [A, B, C, D, E, F, G, H, I, J];\n\njulia> result = cpm(activities);\n\njulia> result.pathstr\n4-element Vector{String}:\n \"B\"\n \"E\"\n \"G\"\n \"I\"\n\n julia> result.path == [B, E, G, I]\ntrue\n\n\n\n\n\n","category":"function"},{"location":"algorithms/#PERT-(Project-Evalutation-and-Review-Technique)","page":"Algorithms","title":"PERT (Project Evalutation and Review Technique)","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"OperationsResearchModels.pert","category":"page"},{"location":"algorithms/#OperationsResearchModels.CPM.pert","page":"Algorithms","title":"OperationsResearchModels.CPM.pert","text":"pert(activities)\n\nArguments\n\nactivities::Vector{PertActivity}: Vector of Pert Activities. \n\nExample\n\njulia> A = PertActivity(\"A\", 1, 2, 3)\nPertActivity(\"A\", 1.0, 2.0, 3.0, PertActivity[])\n\njulia> B = PertActivity(\"B\", 3, 3, 3)\nPertActivity(\"B\", 3.0, 3.0, 3.0, PertActivity[])\n\njulia> C = PertActivity(\"C\", 5, 5, 5, [A, B])\nPertActivity(\"C\", 5.0, 5.0, 5.0, PertActivity[PertActivity(\"A\", 1.0, 2.0, 3.0, PertActivity[]), PertActivity(\"B\", 3.0, 3.0, 3.0, PertActivity[])])\n\njulia> activities = [A, B, C]\n3-element Vector{PertActivity}:\n PertActivity(\"A\", 1.0, 2.0, 3.0, PertActivity[])\n PertActivity(\"B\", 3.0, 3.0, 3.0, PertActivity[])\n PertActivity(\"C\", 5.0, 5.0, 5.0, PertActivity[PertActivity(\"A\", 1.0, 2.0, 3.0, PertActivity[]), PertActivity(\"B\", 3.0, 3.0, 3.0, PertActivity[])])\n\njulia> result = pert(activities)\nPertResult(PertActivity[PertActivity(\"B\", 3.0, 3.0, 3.0, PertActivity[]), PertActivity(\"C\", 5.0, 5.0, 5.0, PertActivity[PertActivity(\"A\", 1.0, 2.0, 3.0, PertActivity[]), PertActivity(\"B\", 3.0, 3.0, 3.0, PertActivity[])])], 8.0, 0.0)\n\njulia> result.mean\n8.0\n\njulia> result.stddev\n0.0\n\n\n\n\n\n","category":"function"},{"location":"algorithms/#Knapsack","page":"Algorithms","title":"Knapsack","text":"","category":"section"},{"location":"algorithms/","page":"Algorithms","title":"Algorithms","text":"OperationsResearchModels.knapsack","category":"page"},{"location":"algorithms/#OperationsResearchModels.Knapsack.knapsack","page":"Algorithms","title":"OperationsResearchModels.Knapsack.knapsack","text":"knapsack(values, weights, capacity)\n\nDescription\n\nSolves the knapsack problem.\n\nArguments\n\nvalues::Vector{Float64}: Values of items.\nweights::Vector{Float64}: Weights of items.\ncapacity::Float64: Capacity of the knapsack.\n\nOutput\n\nKnapsackResult: The custom data type that holds selected items, model, and objective value.\n\n\n\n\n\n","category":"function"}] }