From 41603f9dc789225807243ffce3e3aba419996d27 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Thu, 1 Aug 2024 20:44:09 +0000 Subject: [PATCH] build based on ba4cd28 --- dev/.documenter-siteinfo.json | 2 +- dev/algorithms/index.html | 26 +++++++++++++------------- dev/index.html | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 9dfa09e..aef5ed5 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2024-08-01T20:38:35","documenter_version":"1.5.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2024-08-01T20:44:06","documenter_version":"1.5.0"}} \ No newline at end of file diff --git a/dev/algorithms/index.html b/dev/algorithms/index.html index 3bd3401..ddf77d4 100644 --- a/dev/algorithms/index.html +++ b/dev/algorithms/index.html @@ -18,7 +18,7 @@ julia> result.cost -3.0source

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

OperationsResearchModels.solveMethod
solve(problem)

Description

Solves a shortest path problem given by an object of in type ShortestPathProblem.

Arguments

problem::ShortestPathProblem: The problem in type of ShortestPathProblem

Output

ShortestPathResult: The custom data type that holds path and cost.

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

OperationsResearchModels.solveMethod
solve(problem)

Description

Solves a shortest path problem given by an object of in type ShortestPathProblem.

Arguments

problem::ShortestPathProblem: The problem in type of ShortestPathProblem

Output

ShortestPathResult: The custom data type that holds path and cost.

Example

julia> conns = [
                    Connection(1, 2, 3),
                    Connection(1, 3, 2),
                    Connection(1, 4, 4),
@@ -70,7 +70,7 @@
  Connection(6, 7, 5, "x67")
 
 julia> result.cost
-8.0
source

Maximum Flow

OperationsResearchModels.solveMethod
solve(problem)

Arguments

problem::MaximumFlowProblem: The problem in type of MaximumFlowProblem

Output

MaximumFlowResult: The custom data type that holds path and flow.

Example

julia> conns = [
+8.0
source

Maximum Flow

OperationsResearchModels.solveMethod
solve(problem)

Arguments

problem::MaximumFlowProblem: The problem in type of MaximumFlowProblem

Output

MaximumFlowResult: The custom data type that holds path and flow.

Example

julia> conns = [
                    Connection(1, 2, 3),
                    Connection(1, 3, 2),
                    Connection(1, 4, 4),
@@ -97,7 +97,7 @@
  Connection(6, 7, 3.0, "x67")
 
 julia> result.flow
-7.0
source

Minimum Spanning Tree

OperationsResearchModels.solveMethod
solve(problem::MstProblem)

Arguments

  • problem::MstProblem: The problem in type of MstProblem

Description

Obtains the minimum spanning tree.

Output

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

Examples

julia> conns = Connection[
+7.0
source

Minimum Spanning Tree

OperationsResearchModels.solveMethod
solve(problem::MstProblem)

Arguments

  • problem::MstProblem: The problem in type of MstProblem

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),
@@ -120,7 +120,7 @@
  3-element Vector{Connection}:
   Connection(3, 4, 10, "x34")
   Connection(1, 4, 10, "x14")
-  Connection(2, 3, 10, "x23")
source

pmedian

OperationsResearchModels.PMedian.pmedianFunction
pmedian(data, ncenters)

Arguments

  • data::Matrix: Coordinates of locations
  • ncenters::Int: Number of centers

Description

The 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.

Output

  • PMedianResult: PMedianResult object.

Example

julia> data1 = rand(10, 2);
+  Connection(2, 3, 10, "x23")
source

pmedian

OperationsResearchModels.PMedian.pmedianFunction
pmedian(data, ncenters)

Arguments

  • data::Matrix: Coordinates of locations
  • ncenters::Int: Number of centers

Description

The 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.

Output

  • PMedianResult: PMedianResult object.

Example

julia> data1 = rand(10, 2);
 
 julia> data2 = rand(10, 2) .+ 50;
 
@@ -137,7 +137,7 @@
  21
 
  julia> result.objective
- 11.531012240599605
source

pmedian with distances

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

CPM (Critical Path Method)

OperationsResearchModels.solveMethod
solve(problem)

Arguments

  • problem::CpmProblem: The problem in type of CpmProblem.

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);
+ 11.531012240599605
source

pmedian with distances

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

CPM (Critical Path Method)

OperationsResearchModels.solveMethod
solve(problem)

Arguments

  • problem::CpmProblem: The problem in type of CpmProblem.

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]);
@@ -162,12 +162,12 @@
  "I"
 
  julia> result.path == [B, E, G, I]
-true
source

CPM Activity

OperationsResearchModels.CPM.CpmActivityType
CpmActivity(name::String, time::Float64, dependencies)

Description

The object that represents an activity in CPM (Critical Path Method).

Arguments

  • name::String: The name of the activity.
  • time::Float64: The time of the activity.
  • dependencies: The dependencies of the activity in type of Vector{CpmActivity}.

Example

julia> A = CpmActivity("A", 2, []);
+true
source

CPM Activity

OperationsResearchModels.CPM.CpmActivityType
CpmActivity(name::String, time::Float64, dependencies)

Description

The object that represents an activity in CPM (Critical Path Method).

Arguments

  • name::String: The name of the activity.
  • time::Float64: The time of the activity.
  • dependencies: The dependencies of the activity in type of Vector{CpmActivity}.

Example

julia> A = CpmActivity("A", 2, []);
 
 julia> B = CpmActivity("B", 3, []);
 
 julia> C = CpmActivity("C", 2, [A, B]);
-
source

PERT (Project Evalutation and Review Technique)

OperationsResearchModels.solveMethod
solve(problem::PertProblem)::PertResult

Arguments

  • problem::PertProblem: The problem in type of PertProblem.

Example

julia> A = PertActivity("A", 1, 2, 3)
+
source

PERT (Project Evalutation and Review Technique)

OperationsResearchModels.solveMethod
solve(problem::PertProblem)::PertResult

Arguments

  • problem::PertProblem: The problem in type of PertProblem.

Example

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

PERT Activity

OperationsResearchModels.CPM.PertActivityType
PertActivity(name::String, o::Float64, m::Float64, p::Float64)::PertActivity

Description

The object that represents an activity in PERT (Program Evaluation and Review Technique).

Arguments

  • name::String: The name of the activity.
  • o::Float64: The optimistic time of the activity.
  • m::Float64: The most likely time of the activity.
  • p::Float64: The pessimistic time of the activity.
  • dependencies: The dependencies of the activity in type of Vector{PertActivity}.

Example

julia> A = PertActivity("A", 1, 2, 3);
+0.0
source

PERT Activity

OperationsResearchModels.CPM.PertActivityType
PertActivity(name::String, o::Float64, m::Float64, p::Float64)::PertActivity

Description

The object that represents an activity in PERT (Program Evaluation and Review Technique).

Arguments

  • name::String: The name of the activity.
  • o::Float64: The optimistic time of the activity.
  • m::Float64: The most likely time of the activity.
  • p::Float64: The pessimistic time of the activity.
  • dependencies: The dependencies of the activity in type of Vector{PertActivity}.

Example

julia> A = PertActivity("A", 1, 2, 3);
 julia> B = PertActivity("B", 3, 3, 4);
-julia> C = PertActivity("C", 5, 6, 7, [A, B]);
source

Knapsack

OperationsResearchModels.solveMethod
solve(problem::KnapsackProblem)::KnapsackResult

Description

Solves the knapsack problem.

Arguments

  • problem::KnapsackProblem: The problem in type of KnapsackProblem.

Output

  • KnapsackResult: The custom data type that holds selected items, model, and objective value.

Example

julia> values = [10, 20, 30, 40, 50];
+julia> C = PertActivity("C", 5, 6, 7, [A, B]);
source

Knapsack

OperationsResearchModels.solveMethod
solve(problem::KnapsackProblem)::KnapsackResult

Description

Solves the knapsack problem.

Arguments

  • problem::KnapsackProblem: The problem in type of KnapsackProblem.

Output

  • KnapsackResult: The custom data type that holds selected items, model, and objective value.

Example

julia> values = [10, 20, 30, 40, 50];
 julia> weights = [1, 2, 3, 4, 5];
 julia> capacity = 10;
-julia> solve(KnapsackProblem(values, weights, capacity));
source

Johnson's Rule

OperationsResearchModels.Johnsons.johnsonsFunction
johnsons(times::Matrix)

Given a matrix of times, returns a JohnsonResult with the permutation of the jobs. If number of machines is 2, it uses the Johnson's algorithm for 2 machines. If number of machines is greater than 2, it uses the Johnson's algorithm by transforming the problem into a 2-machine problem. In order to reduce the original problem to a 2-machine problem, the algorithm checks if the minimum time of the first machine is greater or equal than the maximum time of the other machines and/or if the minimum time of the last machine is greater or equal than the maximum time of the other machines.

For example if we have 4 machines, namely, A, B, C, and D at least one of the following conditions must be satisfied:

  • min(A) >= max(B, C)
  • min(D) >= max(B, C)

The function throws a JohnsonException if the problem cannot be reduced to a 2-machine problem.

Arguments

  • times::Matrix: a matrix of times

Returns

  • JohnsonResult: a custom data type that holds the permutation of the jobs

Example

times = Float64[
+julia> solve(KnapsackProblem(values, weights, capacity));
source

Johnson's Rule

OperationsResearchModels.Johnsons.johnsonsFunction
johnsons(times::Matrix)

Given a matrix of times, returns a JohnsonResult with the permutation of the jobs. If number of machines is 2, it uses the Johnson's algorithm for 2 machines. If number of machines is greater than 2, it uses the Johnson's algorithm by transforming the problem into a 2-machine problem. In order to reduce the original problem to a 2-machine problem, the algorithm checks if the minimum time of the first machine is greater or equal than the maximum time of the other machines and/or if the minimum time of the last machine is greater or equal than the maximum time of the other machines.

For example if we have 4 machines, namely, A, B, C, and D at least one of the following conditions must be satisfied:

  • min(A) >= max(B, C)
  • min(D) >= max(B, C)

The function throws a JohnsonException if the problem cannot be reduced to a 2-machine problem.

Arguments

  • times::Matrix: a matrix of times

Returns

  • JohnsonResult: a custom data type that holds the permutation of the jobs

Example

times = Float64[
     3.1 2.8;
     4.0 7.0;
     8.0 3.0;
@@ -208,7 +208,7 @@
 
 result = johnsons(times)
 
-println(result.permutation)
source

Makespan

OperationsResearchModels.Johnsons.makespanFunction
makespan(times::Matrix, permutation::Vector{Int})
+println(result.permutation)
source

Makespan

OperationsResearchModels.Johnsons.makespanFunction
makespan(times::Matrix, permutation::Vector{Int})
 
 Given a matrix of times and a permutation of the jobs, returns the makespan of the jobs.

Arguments

  • times::Matrix: a matrix of times
  • permutation::Vector{Int}: a permutation of the jobs

Returns

  • Float64: the makespan of the jobs

Example


 julia> times = Float64[
@@ -219,4 +219,4 @@
     2 5 6    
 ]
 
-julia> result = makespan(times, [1, 4, 5, 3, 2])
source
+julia> result = makespan(times, [1, 4, 5, 3, 2])source diff --git a/dev/index.html b/dev/index.html index df7c2c1..f059c71 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.