Exemple #1
0
V3MPDRCube* const
V3VrfMPDR::recursiveBlockCube(V3MPDRCube* const badCube) {
   // Create a Queue for Blocking Cubes
   V3BucketList<V3MPDRCube*> badQueue(getPDRFrame());
   assert (badCube); badQueue.add(getPDRDepth(), badCube);
   // Block Cubes from the Queue
   V3MPDRTimedCube baseCube, generalizedCube;
   while (badQueue.pop(baseCube.first, baseCube.second)) {
      assert (baseCube.first < getPDRFrame());
      if (!baseCube.first) {
         // Clear All Cubes in badQueue before Return
         V3Set<const V3MPDRCube*>::Set traceCubes; traceCubes.clear();
         const V3MPDRCube* traceCube = baseCube.second;
         while (true) {
            traceCubes.insert(traceCube); if (_pdrBad == traceCube) break;
            traceCube = traceCube->getNextCube();
         }
         while (badQueue.pop(generalizedCube.first, generalizedCube.second)) {
            if (traceCubes.end() == traceCubes.find(generalizedCube.second)) delete generalizedCube.second;
         }
         return baseCube.second;  // A Cube cannot be blocked by R0 --> Cex
      }
      if (!isBlocked(baseCube)) {
         assert (!existInitial(baseCube.second->getState()));
         // Check Reachability : SAT (R ^ ~cube ^ T ^ cube')
         if (checkReachability(baseCube.first, baseCube.second->getState())) {  // SAT, Not Blocked Yet
            if (profileON()) _ternaryStat->start();
            generalizedCube.second = extractModel(baseCube.second, baseCube.first - 1);
            if (profileON()) _ternaryStat->end();
            badQueue.add(baseCube.first - 1, generalizedCube.second);  // This Cube should be blocked in previous frame
            badQueue.add(baseCube.first, baseCube.second);  // This Cube has not yet been blocked (postpone to future)
         }
         else {  // UNSAT, Blocked
            bool satGen = true;
            while (true) {
               if (profileON()) _generalStat->start();
               generalizedCube.first = baseCube.first;
               generalizedCube.second = new V3MPDRCube(*(baseCube.second));
               generalization(generalizedCube);  // Generalization
               if (profileON()) _generalStat->end();
               addBlockedCube(generalizedCube);  // Record this Cube that is bad and to be blocked
               // I found Niklas Een has modified the original IWLS paper and alter the line below
               // However, I suggest the alteration restricts PDR (i.e. fold-free) and does not help
               if (satGen && (baseCube.first < getPDRDepth()) && (generalizedCube.first < getPDRFrame()))
                  badQueue.add(baseCube.first + 1, baseCube.second);
               //if ((baseCube.first < getPDRDepth()) && (generalizedCube.first < getPDRDepth()))
               //   badQueue.add(generalizedCube.first + 1, baseCube.second);
               if (!isForwardSATGen() || getPDRDepth() <= generalizedCube.first) break;
               baseCube.second = forwardModel(generalizedCube.second); if (!baseCube.second) break;
               baseCube.first = baseCube.first + 1; satGen = false;
               if (checkReachability(baseCube.first, baseCube.second->getState())) break;
            }
         }
      }
      //else delete baseCube.second;
   }
   return 0;
}
/* the objective (fitness) function to be minimized */
double fitfun(double const *x, int N) {
  double * predictions;
  double rho;

  rho = 720;
 
  predictions = forwardModel(N,x,rho, 12.0, 16.0, 20.0);
  return objectiveFunction(32, predictions, observations);

}