ram_optimize.Rd
Solves a linear programming model for resource allocation in agro-pastoral systems.
ram_optimize(profit, resource_use, availability)
Numeric vector. Profit (or objective coefficient) for each activity.
Matrix. Rows = resources, Columns = activities. Each entry gives the use of resource per activity unit.
Numeric vector. Total available amount for each resource (must match number of rows in resource_use
).
A list with:
Named vector of optimal activity levels
Optimal value of the objective function
Status code from lpSolve (0 = success)
profit <- c(20, 25)
resource_use <- matrix(c(1, 2, 2, 3, 3, 0), nrow = 3, byrow = TRUE)
rownames(resource_use) <- c("land", "labor", "feed")
colnames(resource_use) <- c("grazing", "haymaking")
availability <- c(100, 200, 300)
names(availability) <- rownames(resource_use)
ram_optimize(profit, resource_use, availability)
#> $optimal_activities
#> grazing haymaking
#> 100 0
#>
#> $max_profit
#> [1] 2000
#>
#> $status
#> [1] 0
#>