void printOptimal()
  {
    vectord sv(2);  
    sv(0) = 0.1238938; sv(1) = 0.818333;
    std::cout << "Solutions: " << sv << "->" 
	      << evaluateSample(sv) << std::endl;
    sv(0) = 0.5427728; sv(1) = 0.151667;
    std::cout << "Solutions: " << sv << "->" 
	      << evaluateSample(sv) << std::endl;
    sv(0) = 0.961652; sv(1) = 0.1650;
    std::cout << "Solutions: " << sv << "->" 
	      << evaluateSample(sv) << std::endl;
  }
Exemple #2
0
  double DiscreteModel::evaluateSampleInternal( const vectord &query )
  { 
    const double yNext = evaluateSample(query); 
    if (yNext == HUGE_VAL)
      {
	throw std::runtime_error("Function evaluation out of range");
      }
    return yNext;
  }; 
Exemple #3
0
  void DiscreteModel::sampleInitialPoints(matrixd& xPoints, vectord& yPoints)
  {

    vecOfvec perms = mInputSet;
    
    // By using random permutations, we guarantee that 
    // the same point is not selected twice
    utils::randomPerms(perms,mEngine);
    
    // vectord xPoint(mInputSet[0].size());
    for(size_t i = 0; i < yPoints.size(); i++)
      {
	const vectord xP = perms[i];
	row(xPoints,i) = xP;
	yPoints(i) = evaluateSample(xP);
      }
  }
 /**
  * \brief Wrapper for the target function normalize in the hypercube
  * [0,1]
  * @param query point to evaluate in [0,1] hypercube
  * @return actual return value of the target function
  */
 inline double evaluateSampleInternal( const vectord &query )
 {
     return evaluateSample(query);
 };
 /** 
  * \brief Wrapper for the target function normalize in the hypercube
  * [0,1]
  * @param query point to evaluate in [0,1] hypercube
  * @return actual return value of the target function
  */
 inline double evaluateSampleInternal( const vectord &query )
 { 
   vectord unnormalizedQuery = mBB->unnormalizeVector(query);
   return evaluateSample(unnormalizedQuery);
 }; // evaluateSampleInternal