TrapezoidalIntegrator::NodesAndWeights TrapezoidalIntegrator::getNodesAndWeights(int amount) const {
  NodesAndWeights returnParam;
  const double factor = 1./((double)amount +1.);
  generateWeights(returnParam, factor, amount);
  generateNodes(returnParam, factor, amount);
  return returnParam;
}
QueryGraph* QueryGraphCompiler::compile(Query query) {
	q = query;
	relations = q.getRelations().size();
	qg = new QueryGraph(db, relations);
	generateNodes();
	addSelections();
	generateEdges();
	return qg;
}
void osunits::print_nodes(){
	if( NULL == u1 ){
		generateNodes();
	}
	cout << "\nfirst:";
	u1->print_node();
	deque <osnode*>::iterator tn = ulnodes.begin();
	cout << "\nallnodes:\n";
	while( tn != ulnodes.end() ){
		(*tn)->print_node();
		cout << "\n";
		tn ++;
	}
	cout << "last:";
	um->print_node();
	cout<<"\n--------------\n";
}
Example #4
0
void Tree::bfts()
{
  // Run while we don't have a goal
  bool goal = false;
  std::clock_t start = std::clock();
  while (!goal)
  {
    // While the goal isn't empty
    while (!m_frontier.empty() && !goal)
    {
      // Pop element and check for goal state
      Node *cur_node = m_frontier.top();
      m_frontier.pop();
      goal = cur_node->checkGoalState(m_end_pts);

      if (!goal)
      {
        generateNodes(cur_node);
      }
      else
      {
        // Get the time taken
        double duration = (std::clock() - start) / (double) CLOCKS_PER_SEC;

        // Output solution
        printSolution(cur_node, duration);
        printGrid(cur_node);
        goal = true;
      }
    }

    // Increase depth and throw the root back on
    increaseDepth();
    m_frontier.push(m_root);
  }

  return;
}
Example #5
0
void WattsGenerator::generate() const
{
    generateNodes(INITIAL_N);
    generateEdges(INITIAL_N, INITIAL_BETA);
    parameterWindow->show();
}