1309 {
1311 vRandPiOrder.clear();
1312 vRandCosts.clear();
1313 if(nSortTypeOriginal < 0) {
1314 nSortType = rng() % 18;
1315 Print(0, "fanin cost function =", nSortType);
1316 }
1319 switch(nFlow) {
1320 case 0:
1321 RemoveRedundancy();
1322 statsLocal.Reset();
1323 ApplyReverseTopologically([&](int id) {
1325 if(nDistance) {
1326 vCands = pNtk->GetNeighbors(
id,
true, nDistance);
1327 } else {
1328 vCands = pNtk->GetPisInts();
1329 }
1331 });
1332 stats["single"] += statsLocal;
1333 Print(0, statsLocal.GetString());
1334 break;
1335 case 1:
1336 RemoveRedundancy();
1337 statsLocal.Reset();
1338 ApplyReverseTopologically([&](int id) {
1340 if(nDistance) {
1341 vCands = pNtk->GetNeighbors(
id,
true, nDistance);
1342 } else {
1343 vCands = pNtk->GetPisInts();
1344 }
1346 });
1347 stats["multi"] += statsLocal;
1348 Print(0, statsLocal.GetString());
1349 break;
1350 case 2: {
1351 RemoveRedundancy();
1352 double dCost = CostFunction(pNtk);
1353 while(true) {
1354 statsLocal.Reset();
1355 ApplyReverseTopologically([&](int id) {
1357 if(nDistance) {
1358 vCands = pNtk->GetNeighbors(
id,
true, nDistance);
1359 } else {
1360 vCands = pNtk->GetPisInts();
1361 }
1363 });
1364 stats["single"] += statsLocal;
1365 Print(0, "single", ":", "cost", "=", CostFunction(pNtk), ",", statsLocal.GetString());
1366 statsLocal.Reset();
1367 ApplyReverseTopologically([&](int id) {
1369 if(nDistance) {
1370 vCands = pNtk->GetNeighbors(
id,
true, nDistance);
1371 } else {
1372 vCands = pNtk->GetPisInts();
1373
1374 }
1376 });
1377 stats["multi"] += statsLocal;
1378 Print(0, "multi ", ":", "cost", "=", CostFunction(pNtk), ",", statsLocal.GetString());
1379 double dNewCost = CostFunction(pNtk);
1382 } else {
1383 break;
1384 }
1385 }
1386 break;
1387 }
1388 case 3: {
1389 RemoveRedundancy();
1391 if(!nDistance) {
1392 vCands = pNtk->GetPisInts();
1394 }
1396 ApplyRandomlyStop([&](int id) {
1397 statsLocal.Reset();
1398 if(nDistance) {
1399 vCands = pNtk->GetNeighbors(
id,
true, nDistance);
1401 }
1403 if(rng() & 1) {
1406 } else {
1409 }
1411 });
1415 Print(0,
"multi ",
":",
statsMulti.GetString());
1416 break;
1417 }
1418 case 4: {
1419 RemoveRedundancy();
1422 });
1423 break;
1424 }
1425 default:
1427 }
1428 }