예제 #1
0
파일: reac.cpp 프로젝트: Fandekasp/steps
Reac::Reac(string const & id, Volsys * volsys, vector<Spec *> const & lhs,
           vector<Spec *> const & rhs, double kcst)
: pID(id)
, pModel(0)
, pVolsys(volsys)
, pLHS()
, pRHS()
, pOrder(0)
, pKcst(kcst)
{
    if (pVolsys == 0)
    {
        ostringstream os;
        os << "No volsys provided to Reac initializer function";
        throw steps::ArgErr(os.str());
    }
	if (pKcst < 0.0)
	{
		ostringstream os;
		os << "Reaction constant can't be negative";
		throw steps::ArgErr(os.str());
	}

	pModel = pVolsys->getModel();
	assert (pModel != 0);

	setLHS(lhs);
    setRHS(rhs);

    pVolsys->_handleReacAdd(this);
}
예제 #2
0
/* void Dstar::updateStart(int x, int y)
 * --------------------------
 * Update the position of the robot, this does not force a replan.
 */
void Dstar::updateStart(int x, int y) {

  s_start.x = x;
  s_start.y = y;
  
  k_m += heuristic(s_last,s_start);
  
  setRHS(s_start,INFINITY);
  setG(s_start,INFINITY);
  s_start = calculateKey(s_start);
  s_last  = s_start;
}
예제 #3
0
std::pair<unsigned int, real_type>
SolverLinearTrilinos<T>::solve ( MatrixSparse<T>  const& matrix,
                                 Vector<T> & solution,
                                 Vector<T> const& rhs,
                                 const double tol,
                                 const unsigned int m_its )
{
    DVLOG(2) << "Matrix solver...\n";

    setRHS( rhs );
    setLHS( solution );
    setUserOperator( matrix );

    M_Solver.SetParameters( M_List, true );
    M_Solver.Iterate( m_its, tol );

    return std::make_pair( M_Solver.NumIters(), M_Solver.TrueResidual() );
}
예제 #4
0
/* void Dstar::updateVertex(state u)
 * --------------------------
 * As per [S. Koenig, 2002]
 */
void Dstar::updateVertex(state u) {

  list<state> s;
  list<state>::iterator i;

  if (u != s_goal) {
    getSucc(u,s);
    double tmp = INFINITY;
    double tmp2;

    for (i=s.begin();i != s.end(); i++) {
      tmp2 = getG(*i) + cost(u,*i);
      if (tmp2 < tmp) tmp = tmp2;
    }
    if (!close(getRHS(u),tmp)) setRHS(u,tmp);
  }

  if (!close(getG(u),getRHS(u))) insert(u);

}