DiscreteModel::DiscreteModel(const vectori &categories, bopt_params parameters): BayesOptBase(categories.size(),parameters) { mDims = categories.size(); utils::buildGrid(categories,mInputSet); }
/*! @brief construct a tree of Parts * * Given a set of Part components (filters, parents, w, bias), recursively construct * a tree of Parts * @param filters * @param parents * @return */ Part Part::constructPartHierarchy(vector2DMat& filters, vectori& parents) { // error checking assert(filters.size() == parents.size()); // construct the Part tree, from the root node return constructPartHierarchyRecursive(filters, parents, 0, 0); }
int main() { optimize_io int i, n, a, b; lli t, x; cin >> N; for (i = 0; i < N; ++i) { cin >> x; PB(A, MP(x, i + 1)); sum += x; } sort(ALL(A)); for (i = 0; i < N; ++i) { t = sum - A[i].X; x = t / 2; if ((2 * x) == t) { a = lower(x); b = upper(x); n = b - a; if (n > 0 and a < N and A[a].X == x and !(n == 1 and x == A[i].X)) { PB(ans, A[i].Y); } } } cout << ans.size() << '\n'; for (i = 0, n = ans.size(); i < n; ++i) { cout << ans[i] << ' '; } cout << '\n'; return 0; }
//! convert a vector of integers from Matlab 1-based indexing to C++ 0-based indexing static inline void zeroIndex(vectori& idx) { for (unsigned int n = 0; n < idx.size(); ++n) idx[n] -= 1; }
static vectori find(vectori vals, int val) { vectori idx; for (unsigned int n = 0; n < vals.size(); ++n) if(vals[n] == val) idx.push_back(n); return idx; }