Changeset 165
 Timestamp:
 Sep 30, 2005 2:37:20 PM (15 years ago)
 Location:
 trunk
 Files:

 1 added
 3 edited
Legend:
 Unmodified
 Added
 Removed

trunk/CbcModel.cpp
r162 r165 30 30 #include "CbcCountRowCut.hpp" 31 31 #include "CbcCutGenerator.hpp" 32 #include "CbcFeasibilityBase.hpp" 32 33 // include Probing 33 34 #include "CglProbing.hpp" … … 402 403 if (!nodeCompare_) 403 404 nodeCompare_=new CbcCompareDefault();; 405 if (!problemFeasibility_) 406 problemFeasibility_=new CbcFeasibilityBase(); 404 407 # ifdef CBC_DEBUG 405 408 std::string problemName ; … … 442 445 */ 443 446 bool feasible = resolve() ; 447 if (problemFeasibility_>feasible(this,0)<0) { 448 feasible=false; // pretend infeasible 449 } 444 450 /* 445 451 If the linear relaxation of the root is infeasible, bail out now. Otherwise, … … 660 666 if (anyAction == 1) 661 667 { feasible = resolve() ; 668 if (problemFeasibility_>feasible(this,0)<0) { 669 feasible=false; // pretend infeasible 670 } 662 671 resolved = true ; 663 672 # ifdef CBC_DEBUG … … 1052 1061 solver_>setHintParam(OsiDoInBranchAndCut,true,OsiHintDo,NULL) ; 1053 1062 resolved = true ; 1063 if (problemFeasibility_>feasible(this,0)<0) { 1064 feasible=false; // pretend infeasible 1065 } 1054 1066 if (feasible) 1055 1067 { newNode>setObjectiveValue(direction* … … 1644 1656 dblParam_[CbcStartSeconds] = 0.0; 1645 1657 nodeCompare_=new CbcCompareDefault();; 1658 problemFeasibility_=new CbcFeasibilityBase(); 1646 1659 tree_= new CbcTree(); 1647 1660 branchingMethod_=NULL; … … 1729 1742 1730 1743 nodeCompare_=new CbcCompareDefault();; 1744 problemFeasibility_=new CbcFeasibilityBase(); 1731 1745 tree_= new CbcTree(); 1732 1746 branchingMethod_=NULL; … … 1945 1959 } 1946 1960 nodeCompare_=rhs.nodeCompare_>clone(); 1961 problemFeasibility_=rhs.problemFeasibility_>clone(); 1947 1962 tree_= rhs.tree_>clone(); 1948 1963 branchingMethod_=rhs.branchingMethod_; … … 2167 2182 } 2168 2183 nodeCompare_=rhs.nodeCompare_>clone(); 2184 problemFeasibility_=rhs.problemFeasibility_>clone(); 2169 2185 delete tree_; 2170 2186 tree_= rhs.tree_>clone(); … … 2258 2274 delete nodeCompare_; 2259 2275 nodeCompare_=NULL; 2276 delete problemFeasibility_; 2277 problemFeasibility_=NULL; 2260 2278 delete [] addedCuts_; 2261 2279 addedCuts_=NULL; … … 2732 2750 objectiveValue= node>objectiveValue(); 2733 2751 feasible = resolve() ; 2752 if (problemFeasibility_>feasible(this,0)<0) { 2753 feasible=false; // pretend infeasible 2754 } 2734 2755 2735 2756 // Update branching information if wanted … … 5938 5959 nodeCompare_ = compare.clone(); 5939 5960 } 5961 void 5962 CbcModel::setProblemFeasibility(CbcFeasibilityBase * feasibility) 5963 { 5964 delete problemFeasibility_; 5965 problemFeasibility_ = feasibility>clone(); 5966 } 5967 void 5968 CbcModel::setProblemFeasibility(CbcFeasibilityBase & feasibility) 5969 { 5970 delete problemFeasibility_; 5971 problemFeasibility_ = feasibility.clone(); 5972 } 5940 5973 // Set the strategy. Clones 5941 5974 void 
trunk/CbcNode.cpp
r154 r165 23 23 #include "OsiCuts.hpp" 24 24 #include "CbcCountRowCut.hpp" 25 #include "CbcFeasibilityBase.hpp" 25 26 #include "CbcMessage.hpp" 26 27 #include "OsiClpSolverInterface.hpp" … … 862 863 const double * lower = solver>getColLower(); 863 864 const double * upper = solver>getColUpper(); 864 int anyAction=0; 865 // See what user thinks 866 int anyAction=model>problemFeasibility()>feasible(model,0); 867 if (anyAction) { 868 // will return 2 if infeasible , 0 if treat as integer 869 return anyAction1; 870 } 865 871 double integerTolerance = 866 872 model>getDblParam(CbcModel::CbcIntegerTolerance); … … 1358 1364 // See if integer solution 1359 1365 if (model>feasibleSolution(choice[i].numIntInfeasDown, 1360 choice[i].numObjInfeasDown)) 1361 { model>setBestSolution(CBC_STRONGSOL, 1362 newObjectiveValue, 1363 solver>getColSolution()) ; 1366 choice[i].numObjInfeasDown) 1367 &&model>problemFeasibility()>feasible(model,1)>=0) { 1368 model>setBestSolution(CBC_STRONGSOL, 1369 newObjectiveValue, 1370 solver>getColSolution()) ; 1364 1371 model>incrementUsed(solver>getColSolution()); 1365 1372 if (newObjectiveValue >= model>getCutoff()) // *new* cutoff 1366 1373 objectiveChange = 1.0e100 ; 1367 1374 } 1368 1375 } 1369 1376 } else if (iStatus==1) { … … 1442 1449 // See if integer solution 1443 1450 if (model>feasibleSolution(choice[i].numIntInfeasUp, 1444 choice[i].numObjInfeasUp)) 1445 { model>setBestSolution(CBC_STRONGSOL, 1446 newObjectiveValue, 1447 solver>getColSolution()) ; 1451 choice[i].numObjInfeasUp) 1452 &&model>problemFeasibility()>feasible(model,1)>=0) { 1453 model>setBestSolution(CBC_STRONGSOL, 1454 newObjectiveValue, 1455 solver>getColSolution()) ; 1448 1456 model>incrementUsed(solver>getColSolution()); 1449 1457 if (newObjectiveValue >= model>getCutoff()) // *new* cutoff 1450 1458 objectiveChange = 1.0e100 ; 1451 1459 } 1452 1460 } 1453 1461 } else if (iStatus==1) { … … 1770 1778 const double * lower = solver>getColLower(); 1771 1779 const double * upper = solver>getColUpper(); 1772 int anyAction=0; 1780 // See what user thinks 1781 int anyAction=model>problemFeasibility()>feasible(model,0); 1782 if (anyAction) { 1783 // will return 2 if infeasible , 0 if treat as integer 1784 return anyAction1; 1785 } 1773 1786 int i; 1774 1787 int stateOfSearch = model>stateOfSearch(); … … 2249 2262 // See if integer solution 2250 2263 if (model>feasibleSolution(choice.numIntInfeasDown, 2251 choice.numObjInfeasDown)) { 2264 choice.numObjInfeasDown) 2265 &&model>problemFeasibility()>feasible(model,1)>=0) { 2252 2266 model>setBestSolution(CBC_STRONGSOL, 2253 2267 newObjectiveValue, … … 2308 2322 // See if integer solution 2309 2323 if (model>feasibleSolution(choice.numIntInfeasUp, 2310 choice.numObjInfeasUp)) { 2324 choice.numObjInfeasUp) 2325 &&model>problemFeasibility()>feasible(model,1)>=0) { 2311 2326 model>setBestSolution(CBC_STRONGSOL, 2312 2327 newObjectiveValue, 
trunk/include/CbcModel.hpp
r164 r165 25 25 class CbcTree; 26 26 class CbcStrategy; 27 class CbcFeasibilityBase; 27 28 28 29 //############################################################################# … … 954 955 //@} 955 956 957 /** \name Problem feasibility checking */ 958 //@{ 959 // Feasibility functions (which may be overridden by inheritance) 960 inline CbcFeasibilityBase * problemFeasibility() const 961 { return problemFeasibility_;}; 962 void setProblemFeasibility(CbcFeasibilityBase * feasibility); 963 void setProblemFeasibility(CbcFeasibilityBase & feasibility); 964 //@} 965 956 966 /** \name Tree methods and subtree methods */ 957 967 //@{ … … 1451 1461 /// User node comparison function 1452 1462 CbcCompareBase * nodeCompare_; 1463 /// User feasibility function (see CbcFeasibleBase.hpp) 1464 CbcFeasibilityBase * problemFeasibility_; 1453 1465 /// Tree 1454 1466 CbcTree * tree_;
Note: See TracChangeset
for help on using the changeset viewer.