Changes from stable/2.8/Cbc/src/CbcSolverHeuristics.cpp at r1902 to trunk/Cbc/src/CbcSolverHeuristics.cpp at r2105
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Cbc/src/CbcSolverHeuristics.cpp
r1902 r2105 30 30 #include "CbcHeuristicFPump.hpp" 31 31 #include "CbcHeuristicRINS.hpp" 32 #include "CbcHeuristicDW.hpp" 33 #include "CbcHeuristicVND.hpp" 32 34 33 35 #include "CbcHeuristicDiveCoefficient.hpp" … … 1165 1167 int useRINS = parameters_[whichParam(CBC_PARAM_STR_RINS, numberParameters_, parameters_)].currentOptionAsInteger(); 1166 1168 int useRENS = parameters_[whichParam(CBC_PARAM_STR_RENS, numberParameters_, parameters_)].currentOptionAsInteger(); 1169 int useVND = parameters_[whichParam(CBC_PARAM_STR_VND, numberParameters_, parameters_)].currentOptionAsInteger(); 1167 1170 int useDINS = parameters_[whichParam(CBC_PARAM_STR_DINS, numberParameters_, parameters_)].currentOptionAsInteger(); 1168 1171 int useDIVING2 = parameters_[whichParam(CBC_PARAM_STR_DIVINGS, numberParameters_, parameters_)].currentOptionAsInteger(); 1169 1172 int useNaive = parameters_[whichParam(CBC_PARAM_STR_NAIVE, numberParameters_, parameters_)].currentOptionAsInteger(); 1173 int useDW = parameters_[whichParam(CBC_PARAM_STR_DW, numberParameters_, parameters_)].currentOptionAsInteger(); 1170 1174 int kType = (type < 10) ? type : 1; 1171 1175 assert (kType == 1  kType == 2); … … 1294 1298 if (fakeIncrement) 1295 1299 increment = fakeIncrement; 1296 heuristic4.setAbsoluteIncrement(increment); 1300 if (increment>=0.0) 1301 heuristic4.setAbsoluteIncrement(increment); 1302 else 1303 heuristic4.setRelativeIncrement(increment); 1297 1304 heuristic4.setMaximumRetries(r + 1); 1298 1305 if (printStuff) { 1299 1306 if (increment) { 1300 sprintf(generalPrint, "Increment of %g", increment); 1307 if (increment>0.0) 1308 sprintf(generalPrint, "Absolute increment of %g", increment); 1309 else 1310 sprintf(generalPrint, "Relative increment of %g", increment); 1301 1311 generalMessageHandler>message(CBC_GENERAL, generalMessages) 1302 1312 << generalPrint … … 1381 1391 model>addHeuristic(&heuristic6a) ; 1382 1392 } 1383 if ( useRENS >= kType && useRENS <= kType + 1) {1384 #ifndef JJF_ONE 1393 if ((useRENS >= kType && useRENS <= kType + 1) 1394 useRENS>2) { 1385 1395 CbcHeuristicRENS heuristic6(*model); 1386 1396 heuristic6.setHeuristicName("RENS"); 1387 1397 heuristic6.setFractionSmall(0.4); 1388 1398 heuristic6.setFeasibilityPumpOptions(1008003); 1399 int nodes [] = { 2, 50, 50, 50, 200, 1000, 10000, 1, 1, 200}; 1400 heuristic6.setNumberNodes(nodes[useRENS]); 1401 heuristic6.setRensType(useRENS!=9 ? 0 : 32); 1402 model>addHeuristic(&heuristic6) ; 1403 anyToDo = true; 1404 } 1405 if (useVND >= kType && useVND <= kType + 1) { 1406 CbcHeuristicVND heuristic6b(*model); 1407 heuristic6b.setHeuristicName("VND"); 1408 heuristic6b.setFractionSmall(0.4); 1409 heuristic6b.setFeasibilityPumpOptions(1008003); 1389 1410 int nodes [] = { 2, 50, 50, 50, 200, 1000, 10000}; 1390 heuristic6.setNumberNodes(nodes[useRENS]); 1391 #else 1392 CbcHeuristicVND heuristic6(*model); 1393 heuristic6.setHeuristicName("VND"); 1394 heuristic5.setFractionSmall(0.5); 1395 heuristic5.setDecayFactor(5.0); 1396 #endif 1397 model>addHeuristic(&heuristic6) ; 1411 heuristic6b.setNumberNodes(nodes[useVND]); 1412 model>addHeuristic(&heuristic6b) ; 1398 1413 anyToDo = true; 1399 1414 } … … 1454 1469 1455 1470 if (useDIVING > 0) { 1456 int majorIterations= 64;1471 int majorIterations=parameters_[whichParam(CBC_PARAM_INT_DIVEOPTSOLVES, numberParameters_, parameters_)].intValue(); 1457 1472 int diveOptions2 = parameters_[whichParam(CBC_PARAM_INT_DIVEOPT, numberParameters_, parameters_)].intValue(); 1458 1473 int diveOptions; … … 1465 1480 diveOptions2 = 0; 1466 1481 } 1467 if (diveOptions < 0  diveOptions > 9)1482 if (diveOptions < 0  diveOptions > 29) 1468 1483 diveOptions = 2; 1484 int diveOptionsNotC=diveOptions; 1485 if (diveOptions>10) { 1486 if (diveOptions>20) { 1487 diveOptions=20; 1488 diveOptionsNotC=20; 1489 } else { 1490 diveOptions = 10; 1491 diveOptionsNotC = 4; 1492 } 1493 useDIVING = 63; 1494 } 1469 1495 if ((useDIVING&1) != 0) { 1470 1496 CbcHeuristicDiveVectorLength heuristicDV(*model); 1471 1497 heuristicDV.setHeuristicName("DiveVectorLength"); 1472 heuristicDV.setWhen(diveOptions); 1498 heuristicDV.setWhen(diveOptionsNotC); 1499 heuristicDV.setMaxIterations(majorIterations); 1473 1500 if (diveOptions2) { 1474 heuristicDV.setMaxIterations(majorIterations);1475 1501 heuristicDV.setPercentageToFix(0.0); 1476 1502 heuristicDV.setMaxSimplexIterations(COIN_INT_MAX); … … 1482 1508 CbcHeuristicDiveGuided heuristicDG(*model); 1483 1509 heuristicDG.setHeuristicName("DiveGuided"); 1484 heuristicDG.setWhen(diveOptions); 1510 heuristicDG.setWhen(diveOptionsNotC); 1511 heuristicDG.setMaxIterations(majorIterations); 1485 1512 if (diveOptions2) { 1486 heuristicDG.setMaxIterations(majorIterations);1487 1513 heuristicDG.setPercentageToFix(0.0); 1488 1514 heuristicDG.setMaxSimplexIterations(COIN_INT_MAX); … … 1494 1520 CbcHeuristicDiveFractional heuristicDF(*model); 1495 1521 heuristicDF.setHeuristicName("DiveFractional"); 1496 heuristicDF.setWhen(diveOptions); 1522 heuristicDF.setWhen(diveOptionsNotC); 1523 heuristicDF.setMaxIterations(majorIterations); 1497 1524 if (diveOptions2) { 1498 heuristicDF.setMaxIterations(majorIterations);1499 1525 heuristicDF.setPercentageToFix(0.0); 1500 1526 heuristicDF.setMaxSimplexIterations(COIN_INT_MAX); … … 1507 1533 heuristicDC.setHeuristicName("DiveCoefficient"); 1508 1534 heuristicDC.setWhen(diveOptions); 1535 heuristicDC.setMaxIterations(majorIterations); 1509 1536 if (diveOptions2) { 1510 heuristicDC.setMaxIterations(majorIterations);1511 1537 heuristicDC.setPercentageToFix(0.0); 1512 1538 heuristicDC.setMaxSimplexIterations(COIN_INT_MAX); … … 1518 1544 CbcHeuristicDiveLineSearch heuristicDL(*model); 1519 1545 heuristicDL.setHeuristicName("DiveLineSearch"); 1520 heuristicDL.setWhen(diveOptions); 1546 heuristicDL.setWhen(diveOptionsNotC); 1547 heuristicDL.setMaxIterations(majorIterations); 1521 1548 if (diveOptions2) { 1522 heuristicDL.setMaxIterations(majorIterations);1523 1549 heuristicDL.setPercentageToFix(0.0); 1524 1550 heuristicDL.setMaxSimplexIterations(COIN_INT_MAX); … … 1530 1556 CbcHeuristicDivePseudoCost heuristicDP(*model); 1531 1557 heuristicDP.setHeuristicName("DivePseudoCost"); 1532 heuristicDP.setWhen(diveOptions /*+ diveOptions2*/); 1558 heuristicDP.setWhen(diveOptionsNotC /*+ diveOptions2*/); 1559 heuristicDP.setMaxIterations(majorIterations); 1533 1560 if (diveOptions2) { 1534 heuristicDP.setMaxIterations(majorIterations);1535 1561 heuristicDP.setPercentageToFix(0.0); 1536 1562 heuristicDP.setMaxSimplexIterations(COIN_INT_MAX); … … 1589 1615 anyToDo = true; 1590 1616 } 1591 if (useCombine >= kType && useCombine <= kType + 1) { 1617 if (useDW >= kType && useDW <= kType + 1) { 1618 CbcHeuristicDW heuristic13(*model); 1619 heuristic13.setHeuristicName("DantzigWolfe"); 1620 heuristic13.setNumberPasses(100); 1621 heuristic13.setNumberBadPasses(10); 1622 int numberIntegers=0; 1623 const OsiSolverInterface * solver = model>solver(); 1624 int numberColumns = solver>getNumCols(); 1625 for (int i=0;i<numberColumns;i++) { 1626 if(solver>isInteger(i)) 1627 numberIntegers++; 1628 } 1629 heuristic13.setNumberNeeded(CoinMin(200,numberIntegers/10)); 1630 model>addHeuristic(&heuristic13); 1631 anyToDo = true; 1632 } 1633 if (useCombine >= kType && (useCombine1)%3 <= kType ) { 1592 1634 CbcHeuristicLocal heuristic2(*model); 1593 1635 heuristic2.setHeuristicName("combine solutions"); 1594 1636 heuristic2.setFractionSmall(0.5); 1595 heuristic2.setSearchType(1); 1637 int searchType=1; 1638 if (useCombine>3) 1639 searchType += 10; // experiment 1640 heuristic2.setSearchType(searchType); 1596 1641 model>addHeuristic(&heuristic2); 1597 1642 anyToDo = true; 1598 1643 } 1599 if ((useProximity >= kType && useProximity <= kType + 1) 1600 (kType == 1 && useProximity > = 4)){1644 if ((useProximity >= kType && useProximity <= kType + 1)  1645 (kType == 1 && useProximity > 3) ){ 1601 1646 CbcHeuristicProximity heuristic2a(*model); 1602 1647 heuristic2a.setHeuristicName("Proximity Search"); … … 1610 1655 if (useProximity==6) 1611 1656 heuristic2a.setFeasibilityPumpOptions(3); 1657 } else { 1658 int proximityNumber; 1659 parameters_[whichParam(CBC_PARAM_STR_PROXIMITY, numberParameters_, parameters_)].currentOptionAsInteger(proximityNumber); 1660 if (proximityNumber>0) { 1661 heuristic2a.setNumberNodes(proximityNumber); 1662 // more print out and stronger feasibility pump 1663 if (proximityNumber>=300) 1664 heuristic2a.setFeasibilityPumpOptions(3); 1665 } 1612 1666 } 1613 1667 model>addHeuristic(&heuristic2a);
Note: See TracChangeset
for help on using the changeset viewer.