% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/add_objectives.R
\name{add_objective_max_profit}
\alias{add_objective_max_profit}
\title{Add objective: maximize profit}
\usage{
add_objective_max_profit(
  x,
  profit_col = "profit",
  actions = NULL,
  alias = NULL
)
}
\arguments{
\item{x}{A \code{Problem} object.}

\item{profit_col}{Character string giving the profit column in the stored
profit table.}

\item{actions}{Optional subset of actions to include. Values may match
\code{x$data$actions$id} and, if present,
\code{x$data$actions$action_set}. If \code{NULL}, all actions are included.}

\item{alias}{Optional identifier used to register this objective for
multi-objective workflows.}
}
\value{
An updated \code{Problem} object.
}
\description{
Define an objective that maximizes total profit from selected planning
unit--action decisions.
}
\details{
Use this function when the objective is to maximize gross economic return,
without subtracting planning-unit or action costs.

Let \eqn{x_{ia} \in \{0,1\}} denote whether action \eqn{a} is selected in
planning unit \eqn{i}, and let \eqn{\pi_{ia}} denote the profit associated
with that decision, as taken from column \code{profit_col} in the stored
profit table.

If all actions are included, the objective is:

\deqn{
\max \sum_{(i,a) \in \mathcal{D}} \pi_{ia} x_{ia},
}

where \eqn{\mathcal{D}} denotes the set of feasible planning unit--action
decisions.

If \code{actions} is provided, only the selected subset contributes to the
objective. Letting \eqn{\mathcal{D}^{\star}} denote the feasible decisions
whose action belongs to the selected subset, the objective becomes:

\deqn{
\max \sum_{(i,a) \in \mathcal{D}^{\star}} \pi_{ia} x_{ia}.
}

This objective considers profit only. It does not subtract planning-unit
costs or action costs. For a net-profit formulation, use
\code{\link{add_objective_max_net_profit}}.
}
\examples{
pu_tbl <- data.frame(
  id = 1:4,
  cost = c(1, 2, 3, 4)
)
feat_tbl <- data.frame(
  id = 1:2,
  name = c("feature_1", "feature_2")
)
dist_feat_tbl <- data.frame(
  pu = c(1, 1, 2, 3, 4),
  feature = c(1, 2, 2, 1, 2),
  amount = c(5, 2, 3, 4, 1)
)
actions_df <- data.frame(
  id = c("conservation", "restoration"),
  name = c("conservation", "restoration")
)
profit_df <- data.frame(
  pu = c(1, 2, 3, 4, 1, 2, 3, 4),
  action = c("conservation", "conservation", "conservation", "conservation",
             "restoration", "restoration", "restoration", "restoration"),
  profit = c(5, 4, 3, 2, 8, 7, 6, 5)
)

p <- create_problem(
  pu = pu_tbl,
  features = feat_tbl,
  dist_features = dist_feat_tbl,
  cost = "cost"
) |>
  add_actions(actions_df, cost = c(conservation = 1, restoration = 2)) |>
  add_profit(profit_df)

p1 <- add_objective_max_profit(p)
p1$data$model_args

p2 <- add_objective_max_profit(
  p,
  actions = "restoration"
)
p2$data$model_args

}
\seealso{
\code{\link{add_objective_min_cost}},
\code{\link{add_objective_max_net_profit}}
}
