Beispiel #1
0
bool wxDatabaseConfig::GetFirstGroup(wxString& str, long& lIndex) const 
{ 
	m_self->m_groups.clear();
	m_self->GetChildren(m_self->m_entry, &m_self->m_groups, NULL);
	lIndex = 0; 
	return m_groups.size() == 0 ? false : GetNextGroup(str, lIndex); 
} 
void HorizontalSwapper::ProcessRow(int rowIdx)
{
  RowIdx = rowIdx;
  nextColumnIdx = -1;

  if (Direction == HorizontalSearchDirection_RANDOM)
    Direction = ((double)rand()) / RAND_MAX >= 0.5
    ? HorizontalSearchDirection_LEFTTORIGHT
    : HorizontalSearchDirection_RIGHTTOLEFT;

  while (GetNextGroup())
  {
    SaveCellsPositionAsBest();
    double best_diff = 0.0;

    //exhaustive search of best permutation for group
    for (unsigned int i = 0; i < nTotalPermutations; ++i) 
    {
      //TODO: fix problem with terminals      
      PlaceCellsOnTheLeft();
      double diff2 = Utils::CalculateHPWLDiff(m_Grid.Design(), m_ConsideredGroupOfCells, m_GroupSize, false);
      if (checker->CheckCriteria(m_ConsideredGroupOfCells, m_GroupSize, best_diff))
      {
          best_diff = diff2;
          SaveCurrentPositionAsBest();
      }

      if (nEmptySites > 0)
      {
        ImplementEquidistantPermutation();
        double diff1 = Utils::CalculateHPWLDiff(m_Grid.Design(), m_ConsideredGroupOfCells, m_GroupSize, false);
        if (checker->CheckCriteria(m_ConsideredGroupOfCells, m_GroupSize, best_diff))
        {
            best_diff = diff1;
            SaveCurrentPositionAsBest();
        }

        PlaceCellsOnTheRight();
        double diff3 = Utils::CalculateHPWLDiff(m_Grid.Design(), m_ConsideredGroupOfCells, m_GroupSize, false);
        if (checker->CheckCriteria(m_ConsideredGroupOfCells, m_GroupSize, best_diff))
        {
            best_diff = diff3;
            SaveCurrentPositionAsBest();
        }
      }
      MakeNextPermutation();
    }

    //put cells to the best position found (probably initial position)
    for (unsigned int j = 0; j < m_GroupSize; ++j)
      m_Grid.PutCellIntoSite(m_ConsideredGroupOfCells[j], BestPositions[j]);

    if (best_diff < 0.0) //if better permutation was found, update wire length
    {
      Utils::CalculateHPWLDiff(m_Grid.Design(), m_ConsideredGroupOfCells, m_GroupSize, true);
    }
  }
}
Beispiel #3
0
int GetSpecificGroup( FILE* f, int groupNo)
{
    int nextGroup;

    int retVal = GetNextGroup(f, &nextGroup);

    if (0 == retVal)
    {
        retVal = nextGroup == groupNo ? 0 : ERR_FORMAT;
    }
    return retVal;
}
bool wxRegConfig::GetFirstGroup(wxString& str, long& lIndex) const
{
  lIndex = 0;
  return GetNextGroup(str, lIndex);
}