21 std::vector<double> m_profits;
22 std::vector<double> m_weights;
23 std::vector<double> m_capacities;
25 Instance(
unsigned int t_n_knapsacks,
unsigned int t_n_items);
27 Instance(
const Instance&) =
default;
28 Instance(Instance&&)
noexcept =
default;
30 Instance& operator=(
const Instance&) =
default;
31 Instance& operator=(Instance&&)
noexcept =
default;
33 ~Instance() =
default;
34 [[nodiscard]]
unsigned int n_knapsacks()
const {
return m_capacities.size(); }
35 [[nodiscard]]
unsigned int n_items()
const {
return m_profits.size(); }
36 [[nodiscard]]
double profit(
unsigned int t_item)
const {
return m_profits[t_item]; }
37 [[nodiscard]]
double weight(
unsigned int t_item)
const {
return m_weights[t_item]; }
38 [[nodiscard]]
double capacity(
unsigned int t_knapsack)
const {
return m_capacities[t_knapsack]; }
40 [[nodiscard]]
const auto& profits()
const {
return m_profits; }
41 [[nodiscard]]
const auto& weights()
const {
return m_weights; }
42 [[nodiscard]]
const auto& capacities()
const {
return m_capacities; }
44 void set_profit(
unsigned int t_item,
double t_value) { m_profits[t_item] = t_value; }
45 void set_weight(
unsigned int t_item,
double t_value) { m_weights[t_item] = t_value; }
46 void set_capacity(
unsigned int t_knapsack,
double t_value) { m_capacities[t_knapsack] = t_value; }