Skip to content

Commit 08a7e26

Browse files
committed
add example in docs of project selection
1 parent 8f397c4 commit 08a7e26

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/projectselection.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,30 @@ end
6666
# Returns
6767
6868
- `ProjectSelectionResult`: The result of the project selection problem.
69+
70+
# Example
71+
72+
```julia
73+
# Project 1 requires 3M, 5M, and 6M dollars for years 1, 2, and 3 respectively, and returns 10M dollars.
74+
# Project 2 requires 2M, 4M, and 5M dollars for years 1, 2, and 3 respectively, and returns 12M dollars.
75+
# Project 3 requires 5M, 4M, and 2M dollars for years 1, 2, and 3 respectively, and returns 15M dollars.
76+
# etc.
77+
# The budgets for years 1, 2, and 3 are 8M, 9M, and 6M dollars respectively.
78+
# What projects should be selected to maximize returns?
79+
costmatrix = [
80+
3 5 6;
81+
2 4 5;
82+
5 4 2;
83+
2 1 5;
84+
8 9 6;
85+
]
86+
returns = [10, 12, 15, 8, 200]
87+
budgets = [8, 9, 6]
88+
problem = ProjectSelectionProblem(costmatrix, budgets, returns)
89+
result = solve(problem)
90+
println("Selected projects: ", result.selected)
91+
println("Objective value: ", result.objective)
92+
```
6993
"""
7094
function solve(problem::ProjectSelectionProblem)::ProjectSelectionResult
7195

0 commit comments

Comments
 (0)