30 size_t size =
Rand() % 20;
31 std::vector<BaseFloat> item_costs;
32 for (
size_t i = 0;
i < size;
i++) {
33 item_costs.push_back(0.5 * (
Rand() % 15));
37 std::vector<std::vector<size_t> > groups;
40 std::vector<size_t> all_indices;
41 for (
size_t i = 0;
i < groups.size();
i++) {
43 for (
size_t j = 0;
j < groups[
i].size();
j++) {
44 size_t index = groups[
i][
j];
45 all_indices.push_back(index);
46 this_group_cost += item_costs[index];
49 KALDI_ASSERT(groups[
i].size() == 1 || this_group_cost <= max_cost);
53 if (!all_indices.empty())
63 using namespace kaldi;
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void SortAndUniq(std::vector< T > *vec)
Sorts and uniq's (removes duplicates) from a vector.
void UnitTestSolvePackingProblem()
int Rand(struct RandomState *state)
#define KALDI_ASSERT(cond)
Note on how to parse this filename: it contains functions relatied to neural-net training examples...
void SolvePackingProblem(BaseFloat max_cost, const std::vector< BaseFloat > &costs, std::vector< std::vector< size_t > > *groups)
This function solves the "packing problem" using the "first fit" algorithm.