Esempio n. 1
0
bool CMassAction::setInfix(const std::string & infix)
{
  if (infix == "k1*PRODUCT<substrate_i>-k2*PRODUCT<product_j>")
    setReversible(TriTrue);
  else if (infix == "k1*PRODUCT<substrate_i>")
    setReversible(TriFalse);
  else
    return false;

  CFunction::setInfix(infix);
  getVariables().cleanup();

  getVariables().add("k1",
                     CFunctionParameter::FLOAT64,
                     CFunctionParameter::PARAMETER);
  getVariables().add("substrate",
                     CFunctionParameter::VFLOAT64,
                     CFunctionParameter::SUBSTRATE);

  if (isReversible() == TriTrue)
    {
      getVariables().add("k2",
                         CFunctionParameter::FLOAT64,
                         CFunctionParameter::PARAMETER);
      getVariables().add("product",
                         CFunctionParameter::VFLOAT64,
                         CFunctionParameter::PRODUCT);
    }

  return true;
}
Esempio n. 2
0
bool Session::getVariables(const QStringList &oids, QValueVector<QVariant> &retvars, uint32_t &status)
{
	QMutexLocker ml(&m_mutex);
	int maxIterations = oids.count() / 5;
	for(int i = 0; i < maxIterations; i++)
		if ( ! getVariables(oids, retvars, status, i*5) )
			return false;
	
	return getVariables(oids, retvars, status, maxIterations*5);
}
Esempio n. 3
0
void CFunction::createListOfParametersForMathML(std::vector<std::vector<std::string> > & env)
{
  unsigned C_INT32 i, imax = getVariables().size();

  env.clear();
  env.resize(imax);

  for (i = 0; i < imax; ++i)
    {
      env[i].push_back("<mi>" + getVariables()[i]->getObjectName() + "</mi>");
    }
}
Esempio n. 4
0
static void OnCloseClicked(WndButton* pWnd){
  if(pWnd) {
    WndForm * pForm = pWnd->GetParentWndForm();
    bool bIdenti = false;
    getVariables();
    for (unsigned int i=0 ; i < NO_WP_FILES-1; i++)
    {
      if((szWaypointFile[i] != NULL) &&  (_tcslen (szWaypointFile[i])> 0))
      for (unsigned int j=(i+1) ; j < NO_WP_FILES; j++)
      {
        TCHAR tmp[MAX_PATH];
        if((szWaypointFile[j] != NULL) && (_tcslen (szWaypointFile[j])> 0))
        {
		  if(_tcscmp(szWaypointFile[i],szWaypointFile[j])==0)
		  {
		   _sntprintf(tmp, MAX_PATH, _T("%s %u %s %u %s!"), MsgToken(2340), // _@M2340_ "Waypoint Files"
														    i+1,
															MsgToken(2345) , //_@M2345_ "and"
															j+1,
															MsgToken(2346) //_@M2346_ "are identical"
														 );
		    MessageBoxX(  tmp, MsgToken(356),  mbOk) ;  // _@M356_ "Information"
		    bIdenti = true;
		  }
        }
      }
    }
    if( bIdenti) return ;


    if(pForm) {
      pForm->SetModalResult(mrOK);
    }
  }
}
Esempio n. 5
0
void glsl_program :: LinkProgram()
{
  if (!m_num)
    {
      error("can't link zero shaders");
      return;
    }

  if(GLEW_VERSION_2_0)
    LinkGL2();
  else
    LinkARB();

  //post("getting variables");
  getVariables();


#ifdef __APPLE__
  // call API to check if linked program is running on hardware or in software emulation
  GemCGLint vertexGPUProcessing, fragmentGPUProcessing;
  CGLGetParameter (CGLGetCurrentContext(), kCGLCPGPUVertexProcessing, &vertexGPUProcessing);
  CGLGetParameter (CGLGetCurrentContext(), kCGLCPGPUFragmentProcessing, &fragmentGPUProcessing);

  post("vertex shader running in %sware", vertexGPUProcessing?"hard":"soft");
  post("fragment shader running in %sware", fragmentGPUProcessing?"hard":"soft");
#endif //__APPLE__


  // send program ID to outlet
  /* JMZ: shouldn't this be only done, when we have a linked program? */
  t_atom a;
  gem::utils::glsl::atom_setshader(a, (GLEW_VERSION_2_0)?m_program:m_programARB);
  outlet_list(m_outProgramID, 0, 1, &a);

}
Esempio n. 6
0
double RateFree::targetFunk(double x[]) {
	getVariables(x);
    if (optimizing_params != 2)
        // only clear partial_lh if optimizing rates
        phylo_tree->clearAllPartialLH();
	return -phylo_tree->computeLikelihood();
}
Esempio n. 7
0
void CFunction::writeMathML(std::ostream & out,
                            const std::vector<std::vector<std::string> > & env,
                            bool expand, bool fullExpand,
                            unsigned C_INT32 l) const
{
  if (expand && mpRoot)
    {
      bool flag = false; //TODO include check if parantheses are necessary

      if (flag) out << SPC(l) << "<mfenced>" << std::endl;

      mpRoot->writeMathML(out, env, fullExpand, l + 1);

      if (flag) out << SPC(l) << "</mfenced>" << std::endl;
    }
  else //no expand
    {
      out << SPC(l) << "<mrow>" << std::endl;
      out << SPC(l + 1) << CMathMl::fixName(getObjectName()) << std::endl;
      out << SPC(l + 1) << "<mfenced>" << std::endl;

      unsigned C_INT32 i, imax = getVariables().size();

      for (i = 0; i < imax; ++i)
        {
          out << SPC(l + 2) << env[i][0] << std::endl;
        }

      out << SPC(l + 1) << "</mfenced>" << std::endl;
      out << SPC(l) << "</mrow>" << std::endl;
    }
}
Esempio n. 8
0
 bool PadeConstraints::put(xmlNodePtr cur) {
   bool success=getVariables(cur);
   map<string,pair<string,RealType> >::iterator vit(inVars.find("B"));
   if(vit == inVars.end()) return false; //disaster, need to abort
   ID=(*vit).second.first; B=(*vit).second.second;
   return true;
 }
Esempio n. 9
0
Monome* Monome::primitive(Variable* v) const
{
    if(v != *getVariables().begin()) return clone();
	//assert(m_exposant != -1); pas besoin tant que exposant m_uint
    //TODO return new Monome(v, m_multiplicateur/(m_exposant+1), m_exposant+1);
    return 0;
}
Esempio n. 10
0
bool CmdVariable::onServer(DebuggerProxy &proxy) {
  if (m_type == KindOfVariableAsync) {
    //we only do variable inspection on continuation wait handles
    auto frame = getWaitHandleAtAsyncStackPosition(m_frame);

    if (frame != nullptr) {
      auto fp = frame->actRec();
      if (fp != nullptr) {
        m_variables = getVariables(fp);
      }
    }
  }
  else if (m_frame < 0) {
    m_variables = g_context->m_globalVarEnv->getDefinedVariables();
    m_global = true;
  } else {
    m_variables = g_context->getLocalDefinedVariables(m_frame);
    m_global = g_context->getVarEnv(m_frame) == g_context->m_globalVarEnv;
  }

  if (m_global) {
    m_variables.remove(s_GLOBALS);
  }
  if (m_version == 1) {
    // Remove the values before sending to client.
    ArrayInit ret(m_variables->size(), ArrayInit::Map{});
    Variant v;
    for (ArrayIter iter(m_variables); iter; ++iter) {
      ret.add(iter.first().toString(), v);
    }
    m_variables = ret.toArray();
    m_version = 2;
  } else if (m_version == 2) {
    // Remove entries that do not match a non empty m_varName.
    if (!m_varName.empty()) {
      ArrayInit ret(1, ArrayInit::Map{});
      ret.add(m_varName, m_variables[m_varName]);
      m_variables = ret.toArray();
    }
    // Remove entries whose name or contents do not match a non empty m_filter
    if (!m_filter.empty()) {
      ArrayInit ret(m_variables.size(), ArrayInit::Map{});
      for (ArrayIter iter(m_variables); iter; ++iter) {
        String name = iter.first().toString();
        if (name.find(m_filter, 0, false) < 0) {
          String fullvalue = DebuggerClient::FormatVariable(iter.second(), -1);
          if (fullvalue.find(m_filter, 0, false) < 0) {
            continue;
          }
        }
        ret.add(name, iter.second());
      }
      m_variables = ret.toArray();
    }
  }

  return proxy.sendToClient(this);
}
Esempio n. 11
0
double RateGammaInvar::optimizeParameters(double gradient_epsilon) {

	int ndim = getNDim();

	// return if nothing to be optimized
	if (ndim == 0)
		return phylo_tree->computeLikelihood();

    if (verbose_mode >= VB_MED)
        cout << "Optimizing " << name << " model parameters by " << optimize_alg << " algorithm..." << endl;

	if (optimize_alg.find("EM_RR") != string::npos) {
        return randomRestartOptimization(gradient_epsilon);
    } else if (optimize_alg.find("Brent") != string::npos || phylo_tree->aln->frac_const_sites == 0.0 || isFixPInvar() || isFixGammaShape()) {
		double lh = phylo_tree->computeLikelihood();
		cur_optimize = 0;
		double gamma_lh = RateGamma::optimizeParameters(gradient_epsilon);
		ASSERT(gamma_lh >= lh-0.1);
		cur_optimize = 1;
		double invar_lh = -DBL_MAX;
        invar_lh = RateInvar::optimizeParameters(gradient_epsilon);
		ASSERT(invar_lh >= gamma_lh-0.1);
        cur_optimize = 0;
        return invar_lh;
	} else if (optimize_alg.find("EM") != string::npos) {
        return optimizeWithEM(gradient_epsilon);
    } else if (optimize_alg.find("BFGS") != string::npos) {
        //if (freq_type == FREQ_ESTIMATE) scaleStateFreq(false);
        double *variables = new double[ndim+1];
        double *upper_bound = new double[ndim+1];
        double *lower_bound = new double[ndim+1];
        bool *bound_check = new bool[ndim+1];
        double score;

        // by BFGS algorithm
        setVariables(variables);
        setBounds(lower_bound, upper_bound, bound_check);

        score = -minimizeMultiDimen(variables, ndim, lower_bound, upper_bound, bound_check, max(gradient_epsilon, TOL_GAMMA_SHAPE));

        getVariables(variables);

        phylo_tree->clearAllPartialLH();
        score = phylo_tree->computeLikelihood();

        delete [] bound_check;
        delete [] lower_bound;
        delete [] upper_bound;
        delete [] variables;

        return score;
    } else {
        string errMsg = "Unknown optimization algorithm: " + optimize_alg;
        outError(errMsg.c_str());
        return 0.0;
    }
}
Esempio n. 12
0
 bool ScaledPadeConstraints::put(xmlNodePtr cur) {
   bool success=getVariables(cur);
   map<string,pair<string,RealType> >::iterator bit(inVars.find("B"));
   map<string,pair<string,RealType> >::iterator cit(inVars.find("C"));
   if(bit == inVars.end() || cit == inVars.end()) return false; 
   BID=(*bit).second.first; B=(*bit).second.second; 
   CID=(*cit).second.first; C=(*cit).second.second; 
   return true;
 }
Esempio n. 13
0
void script::parseStringScript(std::string in)
{
	//FIX: Do we really need 4 functions when they all run at the same time anyway?
	getVariables(in);
	getFunctions(in);
	getRules(in);
	findSeed(in);

	rawStorage = seed;
}
Esempio n. 14
0
void CFunction::writeMathML(std::ostream & out, unsigned C_INT32 l) const
{
  //out << "<math>" << std::endl;

  out << SPC(l) << "<mrow>" << std::endl;
  out << SPC(l + 1) << CMathMl::fixName(getObjectName()) << std::endl;
  out << SPC(l + 1) << "<mfenced>" << std::endl;

  unsigned C_INT32 i, imax = getVariables().size();

  for (i = 0; i < imax; ++i)
    {
      out << SPC(l + 2) << "<mi>" << getVariables()[i]->getObjectName() << "</mi>" << std::endl;
    }

  out << SPC(l + 1) << "</mfenced>" << std::endl;
  out << SPC(l) << "</mrow>" << std::endl;

  //out << "</math>" << std::endl;
}
Esempio n. 15
0
	void BaseRunTimeConfig::dump()
	{
		getVariables();
		string::size_type longestName = 0;
		for( RunTimeVariableMap::iterator itr = m_variables.begin(); itr != m_variables.end(); ++itr )
			if( itr->first.length() > longestName )
				longestName = itr->first.length();

		for( RunTimeVariableMap::iterator itr = m_variables.begin(); itr != m_variables.end(); ++itr )
		{
			cout.width( (streamsize) longestName + 2 );
			stringstream s;
			s << right << itr->first << ": ";
			cout << s.str() << boolalpha << "\"" << itr->second << "\"" << endl;
		}
	}
Esempio n. 16
0
void script::getVariables(std::string in, unsigned startPos)
{
	//Find first instance of "var" in the string
	startPos = in.find("var", startPos);
	if(startPos != std::string::npos)
	{
		//If not at end of string, we have found a variable, find the end of the it by finding the next ";"
		unsigned nameEnd = in.find_first_of(";", startPos); //FIX: Do we need to find ; since it is only one character?
		//Store the variables identity in name
		char name = in.at(nameEnd-1);
		//Put the variable in the vector for variables in the script class
		variables.push_back(name);
		//Function runs itself from the point after the found variable
		getVariables(in, nameEnd);
	}
	//If we are here we have found all the variables in the script and should exit
}
Esempio n. 17
0
double NGSRateCat::optimizeParameters(double epsilon) {
    int ndim = getNDim();

    // return if nothing to be optimized
    if (ndim == 0) return 0.0;

    cout << "Optimizing " << name << " model parameters..." << endl;


    double *variables = new double[ndim+1];
    double *upper_bound = new double[ndim+1];
    double *lower_bound = new double[ndim+1];
    bool *bound_check = new bool[ndim+1];
    int i;
    double score;

    // by BFGS algorithm
    setVariables(variables);
    for (i = 1; i <= ndim; i++) {
        //cout << variables[i] << endl;
        lower_bound[i] = 1e-4;
        upper_bound[i] = 100.0;
        bound_check[i] = false;
    }
    for (i = ndim-ncategory+2; i <= ndim; i++)
        upper_bound[i] = 1.0;
    //packData(variables, lower_bound, upper_bound, bound_check);
    score = -minimizeMultiDimen(variables, ndim, lower_bound, upper_bound, bound_check, max(epsilon, 1e-6));

    getVariables(variables);

    delete [] bound_check;
    delete [] lower_bound;
    delete [] upper_bound;
    delete [] variables;

    return score;
}
Esempio n. 18
0
 std::pair<unsigned,unsigned> HttpInterface::sendGetVariables(const std::string nodeName, const strings& args)
 {
     unsigned nodePos, varPos;
     for (strings::const_iterator it(args.begin()); it != args.end(); ++it)
     {
         // get node id, variable position and length
         if (verbose)
             cerr << "getVariables " << nodeName << " " << *it;
         const bool exists(getNodeAndVarPos(nodeName, *it, nodePos, varPos));
         if (!exists)
             continue;
         
         VariablesMap vm = allVariables[nodeName];
         const unsigned length(vm[UTF8ToWString(*it)].second);
         
         if (verbose)
             cerr << " (" << nodePos << "," << varPos << "):" << length << "\n";
         // send the message
         GetVariables getVariables(nodePos, varPos, length);
         getVariables.serialize(asebaStream);
     }
     asebaStream->flush();
     return std::pair<unsigned,unsigned>(nodePos,varPos); // just last one
 }
Esempio n. 19
0
double RateInvar::targetFunk(double x[]) {
	getVariables(x);
	// fix bug: computeTip... will update ptn_invar vector
	phylo_tree->computePtnInvar();
	return -phylo_tree->computeLikelihood();
}
Esempio n. 20
0
	void BaseRunTimeConfig::initializeFromBuffer( const string& cfgStr )
	{ TRACER_OP_START("BaseRunTimeConfig::initializeFromBuffer"); TRACER(cfgStr, READ, HEAP, "Configuration string");
        if (&cfgStr != &this->cfgStr)
            this->cfgStr = cfgStr;

        m_warnings.str("");
        RunTimeVariableMap newVars;
        int lineNum = 0;

        try
        {
            getVariables();

            istringstream cfgStream(cfgStr);

            string line;
		    while (getline(cfgStream, line))
            {
                ++lineNum;
                bal::trim(line); // trim whitespace

                // skip blank or comment lines
                if (line.empty() || line.find_first_of("#[") == 0)
                    continue;

                // otherwise, the line must be in the form "Key=Value" and Key must be in the variables map
                if (!bal::contains(line, "="))
                {
                    m_warnings << "Line " << lineNum << ": line does not define a parameter in the \"Parameter = Value\" format.\n";
                    continue;
                }

                size_t predIdx = line.find_first_of('=') + 1;
				TRACER_OP_START("get value for key"); TRACER_BI;
                string key = line.substr(0, predIdx-1); TRACER(key, WRITE, STACK, "Parameter name");
                bal::trim(key);

                if (m_variables.count(key) == 0)
                {
                    m_warnings << "Line " << lineNum << ": \"" << key << "\" is not a supported parameter.\n";
                    continue;
                }

                RunTimeVariableMap::iterator itr = newVars.find(key);
                if (itr != newVars.end())
                {
                    m_warnings << "Line " << lineNum << ": \"" << key << "\" has already been defined.\n";
                    continue;
                }
				
                size_t valBegin = line.find_first_not_of("\t ", predIdx);
                size_t valEnd = valBegin;
                bool inQuote = false;
                for (valEnd = valBegin; valEnd < line.size(); ++valEnd)
                {
                    if (line[valEnd] == '"' && line[valEnd-1] != '\\')
                        inQuote = !inQuote;
                    else if ((line[valEnd] == '#') && !inQuote)
                        break; // stop at unquoted comment token
                }
                
                if (valEnd == valBegin || valBegin == string::npos)
                {
                    m_warnings << "Line " << lineNum << ": no value set for \"" << key << "\"; did you mean to use an empty string (\"\")?\n";
                    continue;
                }

                string& value = newVars[key];
                value = TrimWhitespace(line.substr(valBegin, valEnd-valBegin));
                if (value.empty())
                {
                    m_warnings << "Line " << lineNum << ": no value set for \"" << key << "\"; did you mean to use an empty string (\"\")?\n";
                    continue;
                }

                value = UnquoteString(value);
                bal::replace_all(value, "\\\"", "\"");
                bal::replace_all(value, "true", "1");
                bal::replace_all(value, "false", "0"); TRACER(value, WRITE, HEAP, std::string("Value for ")+std::string(key)); TRACER_BO; TRACER_OP_END("get value for key");
            }
        }
        catch (exception& e)
        {
            m_warnings << "Line " << lineNum << ": " << e.what() << "\n";
        }

        // apply the new variable values
        setVariables(newVars); TRACER_OP_END("BaseRunTimeConfig::initializeFromBuffer");
	}
Esempio n. 21
0
// This is only used when reading Gepasi Files
void CKinFunction::createParameters()
{
  CCopasiVectorN < CFunctionParameter > Substrates;
  CCopasiVectorN < CFunctionParameter > Products;
  CCopasiVectorN < CFunctionParameter > Modifiers;
  CCopasiVectorN < CFunctionParameter > Parameters;
  CCopasiVectorN < CFunctionParameter > Volumes;

  size_t i, imax = mNodes.size();

  CFunctionParameter *pParameter;

  for (i = 0; i < imax; i++)
    {
      if (mNodes[i]->getType() == N_IDENTIFIER)
        {
          // We need to check that we have no reserved name.
          const char *Reserved[] =
            {"pi", "exponentiale", "true", "false", "infinity", "nan",
             "PI", "EXPONENTIALE", "TRUE", "FALSE", "INFINITY", "NAN"
            };

          std::string Name = mNodes[i]->getName();
          size_t j, jmax = 12;

          for (j = 0; j < jmax; j++)
            if (Name == Reserved[j]) break;

          if (j != jmax)
            {
              // It is save to prepend the identifyer with '_' since this is not allowed in
              // Gepasi but within COPASI.
              std::string OldName = Name;
              Name = "_" + Name;

              // We have to replace the corresponding CEvaluationNodes to reflect the change.
              std::vector< CEvaluationNode * >::iterator it = mpNodeList->begin();
              std::vector< CEvaluationNode * >::iterator end = mpNodeList->end();

              for (; it != end; ++it)
                if (((*it)->getType() & 0xFF000000) == CEvaluationNode::CONSTANT &&
                    (*it)->getData() == OldName)
                  (*it)->setData(Name);

              // The Infix has changed we need to update it.
              setInfix(mpRoot->buildInfix());
            }

          pParameter = new CFunctionParameter(Name);
          pParameter->setType(CFunctionParameter::FLOAT64);

          switch (mNodes[i]->getSubtype())
            {
              case N_SUBSTRATE:
                pParameter->setUsage(CFunctionParameter::SUBSTRATE);

                if (Substrates.getIndex(pParameter->getObjectName()) == C_INVALID_INDEX)
                  Substrates.add(pParameter, false);
                else
                  pdelete(pParameter);

                break;

              case N_PRODUCT:
                pParameter->setUsage(CFunctionParameter::PRODUCT);

                if (Products.getIndex(pParameter->getObjectName()) == C_INVALID_INDEX)
                  Products.add(pParameter, false);
                else
                  pdelete(pParameter);

                break;

              case N_MODIFIER:
                pParameter->setUsage(CFunctionParameter::MODIFIER);

                if (Modifiers.getIndex(pParameter->getObjectName()) == C_INVALID_INDEX)
                  Modifiers.add(pParameter, false);
                else
                  pdelete(pParameter);

                break;

              case N_KCONSTANT:
              case N_NOP:
                pParameter->setUsage(CFunctionParameter::PARAMETER);

                if (Parameters.getIndex(pParameter->getObjectName()) == C_INVALID_INDEX)
                  Parameters.add(pParameter, false);
                else
                  pdelete(pParameter);

                break;

              case N_VOLUME:
                pParameter->setUsage(CFunctionParameter::VOLUME);

                if (Volumes.getIndex(pParameter->getObjectName()) == C_INVALID_INDEX)
                  Volumes.add(pParameter, false);
                else
                  pdelete(pParameter);

                break;

              default:
                pdelete(pParameter);
                fatalError();
            }
        }
    }

  getVariables().cleanup();

  imax = Substrates.size();

  for (i = 0; i < imax; i++)
    getVariables().add(Substrates[i], true);

  Substrates.cleanup();

  imax = Products.size();

  for (i = 0; i < imax; i++)
    getVariables().add(Products[i], true);

  Products.cleanup();

  imax = Modifiers.size();

  for (i = 0; i < imax; i++)
    getVariables().add(Modifiers[i], true);

  Modifiers.cleanup();

  imax = Parameters.size();

  for (i = 0; i < imax; i++)
    getVariables().add(Parameters[i], true);

  Parameters.cleanup();

  imax = Volumes.size();

  for (i = 0; i < imax; i++)
    getVariables().add(Volumes[i], true);

  Volumes.cleanup();
}
Esempio n. 22
0
/**
	optimize parameters. Default is to optimize gamma shape
	@return the best likelihood
*/
double RateFree::optimizeParameters(double gradient_epsilon) {

	int ndim = getNDim();

	// return if nothing to be optimized
	if (ndim == 0)
		return phylo_tree->computeLikelihood();

	if (verbose_mode >= VB_MED)
		cout << "Optimizing " << name << " model parameters by " << optimize_alg << " algorithm..." << endl;

    // TODO: turn off EM algorithm for +ASC model
    if ((optimize_alg.find("EM") != string::npos && phylo_tree->getModelFactory()->unobserved_ptns.empty()))
        if (fix_params == 0)
            return optimizeWithEM();

	//if (freq_type == FREQ_ESTIMATE) scaleStateFreq(false);

	double *variables = new double[ndim+1];
	double *upper_bound = new double[ndim+1];
	double *lower_bound = new double[ndim+1];
	bool *bound_check = new bool[ndim+1];
	double score;

//    score = optimizeWeights();

    int left = 1, right = 2;
    if (fix_params == 1) // fix proportions
        right = 1;
    if (optimize_alg.find("1-BFGS") != string::npos) {
        left = 0; 
        right = 0;
    }

    // changed to Wi -> Ri by Thomas on Sept 11, 15
    for (optimizing_params = right; optimizing_params >= left; optimizing_params--) {
    
        ndim = getNDim();
        // by BFGS algorithm
        setVariables(variables);
        setBounds(lower_bound, upper_bound, bound_check);

//        if (optimizing_params == 2 && optimize_alg.find("-EM") != string::npos)
//            score = optimizeWeights();
//        else 
        if (optimize_alg.find("BFGS-B") != string::npos)
            score = -L_BFGS_B(ndim, variables+1, lower_bound+1, upper_bound+1, max(gradient_epsilon, TOL_FREE_RATE));
        else
            score = -minimizeMultiDimen(variables, ndim, lower_bound, upper_bound, bound_check, max(gradient_epsilon, TOL_FREE_RATE));

        getVariables(variables);
        // sort the rates in increasing order
        if (sorted_rates)
            quicksort(rates, 0, ncategory-1, prop);
        phylo_tree->clearAllPartialLH();
        score = phylo_tree->computeLikelihood();
    }
    optimizing_params = 0;

	delete [] bound_check;
	delete [] lower_bound;
	delete [] upper_bound;
	delete [] variables;

	return score;
}
Esempio n. 23
0
double RateGamma::targetFunk(double x[]) {
	getVariables(x);
	phylo_tree->clearAllPartialLH();
	return -phylo_tree->computeLikelihood();
}
Esempio n. 24
0
/**
	the target function which needs to be optimized
	@param x the input vector x
	@return the function value at x
*/
double NGSRateCat::targetFunk(double x[]) {
    getVariables(x);
    if (proportion[ncategory-1] <= 1e-6) return 1e9;
    return -phylo_tree->computeLikelihood();
}
Esempio n. 25
0
 bool PolyConstraints::put(xmlNodePtr cur) {
   //get generic parameters and grid information
   bool success=getVariables(cur);
   return success;
 }