14#include <gtest/gtest.h>
32 std::vector<Project<double>>
projects = {
33 {0, 100, {},
"Profitable A"},
34 {1, 50, {},
"Profitable B"},
45 std::vector<Project<double>>
projects = {
46 {0, 100, {},
"Project A"},
47 {1, -30, {},
"Infra"},
48 {2, 50, {1},
"Project B"},
62 std::vector<Project<double>>
projects = {
63 {0, -50, {},
"Cost A"},
64 {1, -30, {},
"Cost B"},
75 std::vector<Project<double>>
projects;
85 std::vector<Project<double>>
projects = {
86 {0, 100, {1},
"A needs B"},
87 {1, 50, {0},
"B needs A"},
98 std::vector<Project<double>>
projects = {
99 {0, -10, {},
"Foundation"},
100 {1, -10, {0},
"Level 1"},
101 {2, -10, {1},
"Level 2"},
102 {3, 100, {2},
"Payoff"},
122 std::vector<Team>
teams(4);
124 teams[0].name =
"Atlanta";
126 teams[0].losses = 71;
127 teams[0].remaining = 8;
128 teams[0].against = {0, 1, 6, 1};
130 teams[1].name =
"Philly";
132 teams[1].losses = 79;
133 teams[1].remaining = 3;
134 teams[1].against = {1, 0, 0, 2};
136 teams[2].name =
"New York";
138 teams[2].losses = 78;
139 teams[2].remaining = 6;
140 teams[2].against = {6, 0, 0, 0};
142 teams[3].name =
"Montreal";
144 teams[3].losses = 82;
145 teams[3].remaining = 3;
146 teams[3].against = {1, 2, 0, 0};
154 auto teams = create_simple_division();
165 std::vector<Team>
teams(3);
167 teams[0].name =
"Leader";
169 teams[0].remaining = 0;
170 teams[0].against = {0, 0, 0};
172 teams[1].name =
"Middle";
174 teams[1].remaining = 40;
175 teams[1].against = {0, 0, 40};
177 teams[2].name =
"Loser";
179 teams[2].remaining = 50;
180 teams[2].against = {0, 40, 0};
190 auto teams = create_simple_division();
202 auto teams = create_simple_division();
223 std::vector<std::vector<std::array<double, 2>>> data(2,
224 std::vector<std::array<double, 2>>(2));
227 data[0][0] = {100, 10};
230 data[0][1] = {10, 100};
231 data[1][0] = {10, 100};
232 data[1][1] = {10, 100};
246 std::vector<std::vector<std::array<double, 2>>> data(3,
247 std::vector<std::array<double, 2>>(3));
249 for (
int i = 0; i < 3; ++i)
250 for (
int j = 0; j < 3; ++j)
251 data[i][j] = {100, 10};
256 for (
int i = 0; i < 3; ++i)
257 for (
int j = 0; j < 3; ++j)
263 std::vector<std::vector<std::array<double, 2>>> data;
272 std::vector<std::vector<std::array<double, 2>>> data(1,
273 std::vector<std::array<double, 2>>(1));
275 data[0][0] = {5, 10};
294 std::vector<SurveyQuestion>
questions = {
312 std::vector<SurveyQuestion>
questions = {
327 std::vector<SurveyQuestion>
questions = {
343 for (
const auto& [
r, q] : result.assignments)
384 [](
auto*) {
return 0.0; },
385 [](
auto*) {
return 0.0; });
400 std::map<TestNet::Node*, double>
demands;
406 [](
auto*) {
return 0.0; });
426 std::map<TestNet::Node*, double>
demands;
432 [](
auto*) {
return 0.0; });
447 std::map<TestNet::Node*, double>
demands;
477 std::map<TestNet::Node*, double>
demands;
508 [](
auto*) {
return 0.0; },
509 [](
auto*) {
return 0.0; });
531 std::map<TestNet::Node*, double>
demands;
537 [](
auto*) {
return 0.0; });
565 std::map<TestNet::Node*, double>
demands;
571 [](
auto*) {
return 0.0; });
590 [](
auto*) {
return 0.0; },
591 [](
auto*) {
return 0.0; });
599 ::testing::InitGoogleTest(&
argc,
argv);
std::vector< Team > create_simple_division()
constexpr size_t get_num_nodes() const noexcept
Return the total of nodes of graph.
constexpr size_t get_num_arcs() const noexcept
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Main namespace for Aleph-w library functions.
bool eq(const C1 &c1, const C2 &c2, Eq e=Eq())
Check equality of two containers using a predicate.
BaseballEliminationResult check_baseball_elimination(const std::vector< Team > &teams, size_t team_idx)
Check if a team is mathematically eliminated from winning.
ProjectSelectionResult< Value_Type > solve_project_selection(const std::vector< Project< Value_Type > > &projects)
Solve project selection problem using max-flow.
SegmentationResult segment_image(size_t rows, size_t cols, const std::vector< std::vector< std::array< Value_Type, 2 > > > &data_cost, Value_Type smoothness)
Segment image using graph cuts.
SurveyDesignResult design_survey(const std::vector< SurveyQuestion > &questions, const std::vector< SurveyRespondent > &respondents)
Design survey assignment using network flow.
CirculationResult< typename Net::Flow_Type > solve_circulation(Net &net, GetDemand get_demand, GetLower get_lower)
Solve a circulation problem with demands.
Network flow applications.
TEST_F(ProjectSelectionTest, SimpleProjects)
Arc of a flow network implemented with adjacency lists.
Flow network implemented with adjacency lists.
Node * insert_node(const Node_Type &node_info)
Insert a new node by copying node_info.
Arc * insert_arc(Node *src_node, Node *tgt_node, const Flow_Type &cap, const Flow_Type &flow, const typename Arc::Arc_Type &arc_info=Arc_Type())
Insert a capacitated arc with an initial flow.