Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
knapsack_example.cc File Reference

Rich, side-by-side demo for Knapsack variants. More...

#include <iostream>
#include <iomanip>
#include <Knapsack.H>
#include <print_rule.H>
Include dependency graph for knapsack_example.cc:

Go to the source code of this file.

Typedefs

using Item = Knapsack_Item< int, int >
 

Functions

int main ()
 Runs a console demonstration of multiple knapsack problem variants.
 

Detailed Description

Rich, side-by-side demo for Knapsack variants.

Definition in file knapsack_example.cc.

Typedef Documentation

◆ Item

using Item = Knapsack_Item<int, int>

Definition at line 45 of file knapsack_example.cc.

Function Documentation

◆ main()

int main ( )

Runs a console demonstration of multiple knapsack problem variants.

Executes four scenarios (0/1 knapsack, value-only query, unbounded knapsack, and bounded knapsack) that print item tables, capacities, computed optimal values, and summaries of selected items to standard output.

Returns
int Exit status code; 0 on successful completion.

Definition at line 126 of file knapsack_example.cc.

References Aleph::divide_and_conquer_partition_dp(), Aleph::knapsack_01(), Aleph::knapsack_01_value(), Aleph::knapsack_bounded(), Aleph::knapsack_unbounded(), Aleph::print_rule(), r, and Aleph::Array< T >::size().