Try<Owned<VolumeManager>> VolumeManager::create( const http::URL& agentUrl, const string& rootDir, const CSIPluginInfo& info, const hashset<Service>& services, const string& containerPrefix, const Option<string>& authToken, Metrics* metrics) { if (services.empty()) { return Error( "Must specify at least one service for CSI plugin type '" + info.type() + "' and name '" + info.name() + "'"); } return new v0::VolumeManager( agentUrl, rootDir, info, services, containerPrefix, authToken, Runtime(), metrics); }
bool QUBOHeuristic::Report() { double rt = Runtime(); if (qc_) { return qc_->Report(past_solutions_[past_solutions_.size()-1], false, rt); } else { return rt < runtime_limit_; } }
bool QUBOHeuristic::Report(const BaseSolution& solution) { double rt = Runtime(); bool newBest = NewBest(solution, rt); if (qc_) { return qc_->Report(past_solutions_[past_solutions_.size()-1], newBest, rt); } else { return rt < runtime_limit_; } }
bool MaxCutHeuristic::Report(int iter) { double rt = Runtime(); if (mc_) { return mc_->Report(past_solutions_[past_solutions_.size()-1], false, rt, iter); } else { return rt < runtime_limit_; } }
QUBOHeuristic::QUBOHeuristic(const QUBOInstance& qi, double runtime_limit, bool validation, QUBOCallback *qc) : Heuristic(runtime_limit, validation), qi_(qi), qc_(qc) { // Store a new best solution with objective 0 past_solutions_.push_back(QUBOSimpleSolution(qi, this, 0)); past_solution_values_.push_back(0.0); past_solution_times_.push_back(Runtime()); }
bool MaxCutHeuristic::Report(const BaseSolution& solution, int iter) { double rt = Runtime(); bool newBest = NewBest(solution, rt); if (mc_) { return mc_->Report(past_solutions_[past_solutions_.size()-1], newBest, rt, iter); } else { return rt < runtime_limit_; } }
MaxCutHeuristic::MaxCutHeuristic(const MaxCutInstance& mi, double runtime_limit, bool validation, MaxCutCallback *mc) : Heuristic(runtime_limit, validation), mi_(mi), mc_(mc) { // Store a new best solution with objective 0 past_solutions_.push_back(MaxCutSimpleSolution(mi, this, -1)); past_solution_values_.push_back(0.0); past_solution_times_.push_back(Runtime()); }
already_AddRefed<DominatorTree> HeapSnapshot::ComputeDominatorTree(ErrorResult& rv) { Maybe<JS::ubi::DominatorTree> maybeTree; { auto ccrt = CycleCollectedJSRuntime::Get(); MOZ_ASSERT(ccrt); auto rt = ccrt->Runtime(); MOZ_ASSERT(rt); JS::AutoCheckCannotGC nogc(rt); maybeTree = JS::ubi::DominatorTree::Create(rt, nogc, getRoot()); } if (maybeTree.isNothing()) { rv.Throw(NS_ERROR_OUT_OF_MEMORY); return nullptr; } return MakeAndAddRef<DominatorTree>(Move(*maybeTree), this, mParent); }