Skip to content

Commit 9ac5a4e

Browse files
committed
(#2) Fix indentations in docstrings
1 parent 25be985 commit 9ac5a4e

File tree

9 files changed

+60
-39
lines changed

9 files changed

+60
-39
lines changed

src/assignment.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import ..OperationsResearchModels: solve, isbalanced, balance
1414
"""
1515
AssignmentProblem
1616
17-
# Arguments
17+
# Fields
1818
1919
- `costs::Matrix{T}`: The cost matrix of the assignment problem.
2020
@@ -31,9 +31,9 @@ end
3131

3232

3333
"""
34-
AssignmentResult(problem, solution, cost)
34+
AssignmentResult
3535
36-
# Arguments
36+
# Fields
3737
3838
- `problem::AssignmentProblem`: The original assignment problem.
3939
- `solution::Matrix`: The solution matrix of the assignment problem.

src/cpm.jl

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export PertResult
1919
2020
The object that represents an activity in CPM (Critical Path Method).
2121
22-
# Arguments
22+
# Fields
2323
- `name::String`: The name of the activity.
2424
- `time::Float64`: The time of the activity.
2525
- `dependencies`: The dependencies of the activity in type of `Vector{CpmActivity}`.
@@ -41,8 +41,9 @@ struct CpmActivity
4141
dependencies::Vector{CpmActivity}
4242
end
4343

44+
4445
"""
45-
CpmProblem
46+
CpmProblem(activities::Vector{CpmActivity})
4647
4748
# Description
4849
@@ -59,7 +60,7 @@ end
5960

6061

6162
"""
62-
CpmResult
63+
CpmResult(pathstr::Vector{String}, path::Vector{CpmActivity})
6364
6465
# Description
6566
@@ -86,7 +87,7 @@ end
8687
8788
The object that represents an activity in PERT (Program Evaluation and Review Technique).
8889
89-
# Arguments
90+
# Fields
9091
- `name::String`: The name of the activity.
9192
- `o::Float64`: The optimistic time of the activity.
9293
- `m::Float64`: The most likely time of the activity.
@@ -112,7 +113,7 @@ end
112113

113114

114115
"""
115-
PertProblem
116+
PertProblem(activities::Vector{PertActivity})
116117
117118
# Description
118119
@@ -129,7 +130,7 @@ end
129130

130131

131132
"""
132-
PertResult
133+
PertResult(path::Vector{PertActivity}, mean::Float64, stddev::Float64)
133134
134135
# Description
135136
@@ -198,6 +199,7 @@ function pathtostring(activities::Vector{CpmActivity})::Vector{String}
198199
return reverse(v)
199200
end
200201

202+
201203
"""
202204
solve(problem)
203205
@@ -306,7 +308,11 @@ end
306308
307309
- `problem::PertProblem`: The problem in type of PertProblem.
308310
309-
# Example
311+
# Output
312+
313+
- `::PertResult`: The object holds the results
314+
315+
# Example
310316
311317
```julia
312318
julia> A = PertActivity("A", 1, 2, 3)

src/game.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ end
4444
"""
4545
solve(p::GameProblem; verbose::Bool = false)::Vector{GameResult}
4646
47-
Solves a zero-sum game using the simplex method.
47+
Solves a zero-sum game using the simplex method.
4848
4949
# Arguments
5050

src/mst.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export MstProblem
1414
MstProblem
1515
1616
# Description
17-
Defines the minimum spanning tree problem.
17+
18+
Defines the minimum spanning tree problem.
1819
1920
# Fields
2021
- `connections::Vector{Connection}`: The connections (edges) in the network.
@@ -33,7 +34,8 @@ end
3334
MstResult
3435
3536
# Description
36-
A structure to hold the result of the minimum spanning tree problem.
37+
38+
A structure to hold the result of the minimum spanning tree problem.
3739
3840
# Fields
3941
- `connections::Vector{Connection}`: The connections (edges) in the minimum spanning tree.
@@ -122,14 +124,14 @@ end
122124
"""
123125
solve(problem::MstProblem)
124126
125-
# Arguments
126-
127-
- `problem::MstProblem`: The problem in type of MstProblem
128-
129127
# Description
130128
131129
Obtains the minimum spanning tree.
132130
131+
# Arguments
132+
133+
- `problem::MstProblem`: The problem in type of MstProblem
134+
133135
# Output
134136
135137
- `::MstResult`: A MstResult object that holds the results.

src/pmedian.jl

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,16 @@ end
3939
4040
pmedian(data, ncenters)
4141
42-
# Arguments
43-
44-
- `data::Matrix`: Coordinates of locations
45-
- `ncenters::Int`: Number of centers
46-
4742
# Description
4843
4944
The function calculates Euclidean distances between all possible rows of the matrix data.
50-
`ncenters` locations are then selected that minimizes the total distances to the nearest rows.
45+
`ncenters` locations are then selected that minimizes the total distances to the nearest rows.
46+
47+
48+
# Arguments
49+
50+
- `data::Matrix`: Coordinates of locations
51+
- `ncenters::Int`: Number of centers
5152
5253
# Output
5354
@@ -100,14 +101,15 @@ end
100101
101102
pmedian_with_distances(distancematrix, ncenters)
102103
104+
# Description
105+
106+
`ncenters` locations are selected that minimizes the total distances to the nearest rows.
107+
103108
# Arguments
109+
104110
- `distancematrix::Matrix`: n x n matrix of distances
105111
- `ncenters::Int`: Number of centers
106112
107-
# Description
108-
109-
- `ncenters` locations are selected that minimizes the total distances to the nearest rows.
110-
111113
# Output
112114
- `PMedianResult`: PMedianResult object.
113115
"""

src/shortestpath.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@ julia> result.path
8989
julia> result.cost
9090
8.0
9191
```
92+
93+
# NOTE
94+
95+
In this function it's assumed that the problem has a unique start and finish node.
96+
A heuristic approach is used to find the start and finish nodes. If a node has only
97+
outcoming connections, it is considered the start node. If a node has only incoming connections,
98+
it is considered the finish node. Of course a network can have multiple start and finish nodes,
99+
but this heuristic simplifies the problem. Future implementations could explore more complex
100+
scenarios with multiple start and finish nodes.
92101
"""
93102
function solve(problem::ShortestPathProblem)
94103

src/simplex.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,8 @@ end
417417
418418
# Description
419419
420-
Solves the given SimplexProblem using the Simplex algorithm. The `solve!` function
421-
modifies the input SimplexProblem in place.
420+
Solves the given SimplexProblem using the Simplex algorithm. The `solve!` function
421+
modifies the input SimplexProblem in place.
422422
423423
# Arguments
424424
@@ -446,8 +446,8 @@ end
446446
447447
# Description
448448
449-
This function performs the Simplex iterations on the given SimplexProblem and returns the
450-
history of SimplexProblem states.
449+
This function performs the Simplex iterations on the given SimplexProblem and returns the
450+
history of SimplexProblem states.
451451
452452
# Arguments
453453
@@ -520,7 +520,7 @@ end
520520
521521
# Description
522522
523-
This function creates a SimplexProblem object from the given parameters.
523+
This function creates a SimplexProblem object from the given parameters.
524524
525525
# Arguments
526526
@@ -532,7 +532,7 @@ end
532532
533533
# Returns
534534
535-
A SimplexProblem object.
535+
A SimplexProblem object.
536536
537537
# Example
538538
@@ -585,7 +585,7 @@ end
585585
586586
# Description
587587
588-
Attaches an Identity matrix to the right of the given matrix A and applies the Gauss-Jordan elimination method to find the inverse of the given matrix.
588+
Attaches an Identity matrix to the right of the given matrix A and applies the Gauss-Jordan elimination method to find the inverse of the given matrix.
589589
590590
# Arguments
591591
@@ -594,7 +594,7 @@ end
594594
595595
# Returns
596596
597-
The inverse of the given matrix.
597+
The inverse of the given matrix.
598598
599599
# Example
600600

src/transportation.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import ..OperationsResearchModels: solve, balance, isbalanced
1717
"""
1818
TransportationProblem
1919
20-
# Arguments
20+
# Fields
2121
2222
- `costs::Matrix{T}`: The cost matrix of the transportation problem.
2323
- `demand::Vector{T}`: The demand vector of the transportation problem.
@@ -37,7 +37,7 @@ end
3737
"""
3838
TransportationResult(problem, balancedProblem, solution, cost)
3939
40-
# Arguments
40+
# Fields
4141
4242
- `problem::TransportationProblem`: The original transportation problem.
4343
- `balancedProblem::TransportationProblem`: The balanced transportation problem.

src/travelingsalesman.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export TravelingSalesmanResult
1313
TravelingSalesmanProblem
1414
1515
# Description
16-
A data structure to hold the problem definition of the traveling salesman problem.
16+
17+
A data structure to hold the problem definition of the traveling salesman problem.
1718
1819
# Fields
1920
@@ -30,7 +31,8 @@ end
3031
TravelingSalesmanResult
3132
3233
# Description
33-
A data structure to hold the result of the traveling salesman problem.
34+
35+
A data structure to hold the result of the traveling salesman problem.
3436
3537
# Fields
3638
- `route::Vector{Int}`: The best route found.

0 commit comments

Comments
 (0)