Пример #1
0
bool FlowControllerImpl::AddUp(int ns, int in, int out)
{
  ASSERTNS(ns);
  // AddUp total first
  bool is_relaxed = false;
  if (ns != MAXAREA)
  {
    is_relaxed = AddUp(MAXAREA, in, out);
  }
  AreaFlow &flow = flows_[ns];
  bool limit = false;
  limit = !AddUp(flow.in, in) || limit; 
  limit = !AddUp(flow.out, out) || limit; 
  limit = !AddUp(flow.ops, 1) || limit; 
  if (limit == true)
    flow.status = UP;
  log_debug("Add up: ns %d, in %d, out %d, status %s", 
      ns, in, out, FlowStatusStr(flow.status));
  return is_relaxed || flow.status == DOWN;
}
Пример #2
0
void NetWorkLayer::ComputeOutputs(const vector<double> &input) {
  outputs.clear();
  for(int i = 0; i < outputNum; ++i) {
    outputs.push_back(AddUp(i, input));
  }
}