-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalgorithm.cc
More file actions
33 lines (27 loc) · 862 Bytes
/
algorithm.cc
File metadata and controls
33 lines (27 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2025 The Authors (see AUTHORS file)
// SPDX-License-Identifier: Apache-2.0
#include "algorithm.h"
#include <cassert>
#include <memory>
#include "fairness_constraint.h"
#include "matroid.h"
#include "submodular_function.h"
void Algorithm::Init(const SubmodularFunction& sub_func_f,
const FairnessConstraint& fairness,
const Matroid& matroid) {
sub_func_f_ = sub_func_f.Clone();
sub_func_f_->Reset();
fairness_ = fairness.Clone();
fairness_->Reset();
matroid_ = matroid.Clone();
matroid_->Reset();
}
int Algorithm::GetNumberOfPasses() const {
// default is one-pass
return 1;
}
void Algorithm::BeginNextPass() {
// multi-pass algorithms should overload this, so if we ever reach here,
// this means that the algorithm is single-pass (so this should not be called)
assert(false);
}