Example #1
0
 /**
  * Performs one heuristic step
  * @param s starting point
  * @return true if the search is completed, false if the search is interrupted
  */
 virtual bool step(std::vector<Solution>& sv)
 {
   VT v;
   mLog << "Starting ";
   if(mStartFromZero)
     mLog << "START_FROM_ZERO";
   else
     mLog << "START_FROM_X";
   mLog << "(" << mNumberOfStarts << " starts)\n";
   BNB_ASSERT(mLocOpt);
   BNB_ASSERT(sv.size() == 1);
   Solution s = sv.at(0);
   sv.pop_back();
   BNB_ASSERT(mNumberOfStarts > 0);
   for(int i = 0; i < mNumberOfStarts;) {
     pertrub(i, s.mX);
     i ++;
     if(mLocOpt->search(mAux, &mAuxV)) {
       if(mAuxV < s.mFval) {
         pushPoint(sv);
         if(mGreedy)
           break;
       }
     }        
     mLog << "OLD = " << s.mFval << "AUXV" << mAuxV << "\n";
   }
   mLog.write();
   return true;
 }
Example #2
0
node *gridDraw(int row,int column)
{
	int i,j ;
	node *head=createQue();
	widthOfOneGrid = screenWidth / row;
	heightOfOneGrid = screenHeight / column;
	GLfloatPoint point;
	for(i=0;i<screenHeight;i+=heightOfOneGrid)
	{
		for(j=0;j<screenWidth;j+=widthOfOneGrid)
		{
			point.x = j;
			point.y = i;
			pushPoint(head,point);
		}
	}
	return head;
}
Example #3
0
Bool_t TempVsTime::Process(Long64_t entry)
{
  // The Process() function is called for each entry in the tree (or possibly
  // keyed object in the case of PROOF) to be processed. The entry argument
  // specifies which entry in the currently loaded tree is to be processed.
  // It can be passed to either TempVsTime::GetEntry() or TBranch::GetEntry()
  // to read either all or the required parts of the data. When processing
  // keyed objects with PROOF, the object is already loaded and is available
  // via the fObject pointer.
  //
  // This function should contain the "body" of the analysis. It can contain
  // simple or elaborate selection criteria, run algorithms on the data
  // of the event and typically fill histograms.
  //
  // The processing can be stopped by calling Abort().
  //
  // Use fStatus to set the return value of TTree::Process().
  //
  // The return value is currently not used.
  
  GetEntry(entry);

  static bool firstEntry = true;
  if (firstEntry) {
    minUTime = uTime;
    lastCurrent = current1;
    lastWorkingTemperature = workingTemperature;
    firstEntry = false;
  }
  
  uTime -= minUTime;
  maxUTime = uTime;

  temperature0 -= cal[0];
  temperature1 -= cal[1];
  temperature2 -= cal[2];
  temperature3 -= cal[3];
  temperature4 -= cal[4];
  temperature5 -= cal[5];
  temperature6 -= cal[6];
  temperature7 -= cal[7];

  checkTemperature(temperature0);
  checkTemperature(temperature1);
  checkTemperature(temperature2);
  checkTemperature(temperature3);
  checkTemperature(temperature4);
  checkTemperature(temperature5);
  checkTemperature(temperature6);
  checkTemperature(temperature7);

  T1 = temperature0;
  T2 = temperature1;
  T3 = temperature2;
  T4 = temperature3;
  T5 = temperature4;
  Ttop = temperature5;
  Tbottom = temperature6;
  Tambient = temperature7;
  
  if (checkTemperature2(T1)) pushPoint(grT[1], uTime, T1);
  if (checkTemperature2(T2)) pushPoint(grT[2], uTime, T2);
  if (checkTemperature2(T3)) pushPoint(grT[3], uTime, T3);
  if (checkTemperature2(T4)) pushPoint(grT[4], uTime, T4);
  if (checkTemperature2(T5)) pushPoint(grT[5], uTime, T5);

  if (checkTemperature2(Ttop)) pushPoint(grTtop, uTime, Ttop);
  if (checkTemperature2(Tbottom)) pushPoint(grTbottom, uTime, Tbottom);
  if (checkTemperature2(Tambient)) pushPoint(grTambient, uTime, Tambient);

  pushPoint(grCurrent, uTime, current1);
  pushPoint(grVoltage, uTime, voltage1);
  if (current1!=lastCurrent) {
    std::cout << "current changed to " << current1 << " A (" << voltage1 << " V) @ " << uTime << std::endl;
  }
  lastCurrent = current1;

  pushPoint(grBath, uTime, bathTemperature);
  if (workingTemperature!=lastWorkingTemperature) {
    std::cout << "working temperature changed to " << workingTemperature << " degC @ " << uTime << std::endl;
  }
  lastWorkingTemperature = workingTemperature;
  
  return kTRUE;
}
Example #4
0
void Chart3D::generateChartData()
{
    CheckGL("Begin Chart3D::generateChartData");
    static const float border[] = { -1, -1, 1,  -1, -1, -1,  -1, -1, -1,  1, -1, -1,  1, -1, -1,  1, 1, -1 };
    static const int nValues = sizeof(border)/sizeof(float);

    std::vector<float> decorData;
    std::copy(border, border+nValues, std::back_inserter(decorData));

    float step = 2.0f/(mTickCount);

    /* push tick points for z axis:
     * push (0,0) first followed by
     * [-1, 0) ticks and then
     * (0, 1] ticks  */
    pushPoint(decorData, -1.0f, -1.0f, 0.0f);
    pushTicktextCoords(-1.0f, -1.0f, 0.0f);
    mZText.push_back(toString(0));

    int ticksLeft = mTickCount/2;
    for(int i=1; i<=ticksLeft; ++i) {
        /* (0, -1] to [-1, -1] */
        float neg = i*-step;
        pushPoint(decorData, -1.0f, -1.0f, neg);
        /* push tick marks */
        pushTicktextCoords(-1.0f, -1.0f, neg);
        /* push tick text label */
        mZText.push_back(toString(neg));

        /* (0, -1] to [1, -1] */
        float pos = i*step;
        pushPoint(decorData, -1.0f, -1.0f, pos);
        /* push tick marks */
        pushTicktextCoords(-1.0f, -1.0f, pos);
        /* push tick text label */
        mZText.push_back(toString(pos));
    }
    /* push tick points for y axis:
     * push (0,0) first followed by
     * [-1, 0) ticks and then
     * (0, 1] ticks  */
    pushPoint(decorData, 1.0f, 0.0f, -1.0f);
    pushTicktextCoords(1.0f, 0.0f, -1.0f);
    mYText.push_back(toString(0));

    for(int i=1; i<=ticksLeft; ++i) {
        /* [-1, 0) to [-1, -1] */
        float neg = i*-step;
        pushPoint(decorData, 1.0f, neg, -1.0f);
        pushTicktextCoords(1.0f, neg, -1.0f);
        mYText.push_back(toString(neg));

        /* [-1, 0) to [-1, 1] */
        float pos = i*step;
        pushPoint(decorData, 1.0f, pos, -1.0f);
        pushTicktextCoords(1.0f, pos, -1.0f);
        mYText.push_back(toString(pos));
    }

    /* push tick points for x axis:
     * push (0,0) first followed by
     * [-1, 0) ticks and then
     * (0, 1] ticks  */
    pushPoint(decorData, 0.0f, -1.0f, -1.0f);
    pushTicktextCoords( 0.0f, -1.0f, -1.0f);
    mXText.push_back(toString(0));

    for(int i=1; i<=ticksLeft; ++i) {
        /* (0, -1] to [-1, -1] */
        float neg = i*-step;
        pushPoint(decorData, neg, -1.0f, -1.0f);
        pushTicktextCoords( neg, -1.0f, -1.0f);
        mXText.push_back(toString(neg));

        /* [-1, 0) to [-1, 1] */
        float pos = i*step;
        pushPoint(decorData, pos, -1.0f, -1.0f);
        pushTicktextCoords( pos, -1.0f, -1.0f);
        mXText.push_back(toString(pos));
    }

    /* check if decoration VBO has been already used(case where
     * tick marks are being changed from default(21) */
    if (mDecorVBO != 0)
        glDeleteBuffers(1, &mDecorVBO);

    /* create vbo that has the border and axis data */
    mDecorVBO = createBuffer<float>(GL_ARRAY_BUFFER, decorData.size(),
                                    &(decorData.front()), GL_STATIC_DRAW);
    CheckGL("End Chart3D::generateChartData");
}