Go to the documentation of this file.
39 #include "OsiCuts.hpp"
40 #include "OsiSolverInterface.hpp"
412 std::vector<BlisConstraint *> cons);
555 std::cout <<
"3. cutoff_ = "<<
cutoff_
556 <<
"; inc = " << inc << std::endl;
561 lpSolver_->setDblParam(OsiDualObjectiveLimit, co);
573 int & numObjectInfs);
664 double integerTolerance = 1.0e-5;
665 double nearest = floor(value + 0.5);
666 if (fabs(value - nearest) <= integerTolerance) {
698 const char * name = NULL,
700 int cutGenerationFrequency = 1,
702 bool atSolution =
false,
703 bool whenInfeasible =
false);
795 bool ifNotSimpleIntegers,
796 int defaultValue = 1000);
virtual AlpsTreeNode * createRoot()
For parallel code, only the master calls this function.
double * getObjCoef() const
Get objective coefficients.
This class contains the solutions generated by the LP solver (either primal or dual.
void setOldConstraintsSize(int num)
Set max number of old constraints.
void delOldConstraints()
Set max number of old constraints.
BcpsBranchStrategy * branchStrategy_
Variable selection function.
double currAbsGap_
Current absolute optimal gap.
void setSharedObjectMark(int i)
Mark object to be shared.
BcpsBranchStrategy * rampUpBranchStrategy() const
double cutoff_
Cutoff in lp solver.
void setBranchingMethod(BcpsBranchStrategy &method)
Set the branching stratedy.
double * getConRandoms() const
Get randoms for check parallel constraints.
int numIntObjects_
Column types.
BcpsConstraintPool * constraintPoolSend()
Access send constraint pool.
AlpsReturnStatus encodeBlis(AlpsEncoded *encoded) const
Pack Blis portion of the model into an encoded object.
void addHeuristic(BlisHeuristic *heur)
Add a heuristic.
void createObjects()
Create variables and constraints.
void unpackSharedConstraints(AlpsEncoded &encoded)
Unpack and store shared constraints.
virtual BlisSolution * userFeasibleSolution(const double *solution, bool &feasible)
User's criteria for a feasible solution.
virtual BlisSolution * feasibleSolution(int &numIntegerInfs, int &numObjectInfs)
Test the current LP solution for feasiblility.
virtual AlpsEncoded * encode() const
The method that encodes the model into an encoded object.
void unpackSharedVariables(AlpsEncoded &encoded)
Unpack and store shared variables.
A interface to Osi/Coin Presolve.
double * varLB()
Get variable bounds arrary.
Interface between Blis and Cut Generation Library.
int numObjects_
Number of objects.
std::vector< AlpsTreeNode * > leafToRootPath
Record the path from leaf to root.
int numBranchResolve_
Maximum number of resolve during branching.
BcpsConstraintPool * constraintPoolReceive()
Access receive constraint pool.
void setCutoff(double co)
Set cut off value.
int numNodes_
Number of processed nodes.
virtual void registerKnowledge()
Register knowledge.
void addObjects(int numObjects, BcpsObject **objects)
Add in object information.
virtual void writeParameters(std::ostream &outstream) const
Write out parameters.
int getNumBranchResolve()
Get the maximum number of resolve during branching.
void setNodeWeight(double nw)
virtual bool fathomAllNodes()
Return true, if all nodes can be fathomed.
int boundingPass_
The number of passes during bounding procedure.
int oldConstraintsSize_
The memory size allocated for oldConstraints_.
void setOldConstraints(BlisConstraint **old)
set old constraints.
BlisConGenerator * cutGenerators(int i) const
Get a specific cut generator.
bool resolve()
Resolving a lp.
void init()
Intialize member data.
virtual void presolveForTheWholeTree()
int priority(int sequence) const
Returns priority level for an object (or 1000 if no priorities exist)
BlisConGenerator ** generators_
The list of cut generators used.
int numOldConstraints_
Number of old constraints.
BcpsConstraintPool * constraintPool()
Access constraint pool.
int getMaxNumCons() const
Get the max number of cuts can be generated.
int getNumSolutions() const
Get number of solutions.
int getNumRows()
Get number of rows.
CoinPackedMatrix * colMatrix_
Column majored matrix.
virtual AlpsEncoded * packSharedKnowlege()
Pack knowledge to be shared with others into an encoded object.
int numHeuristics_
Number of heuristics.
void clearSharedObjectMark()
Clear all the share mark.
int numStrong_
Number of strong branching.
const int * priority() const
Priorities.
virtual void decodeToSelf(AlpsEncoded &)
The method that decodes the model from an encoded object.
int getFeasCheckTime()
Get the total time spent checking solutions for feasibility.
void setFeasCheckTime(double t)
Set the total time spent checking solutions for feasibility.
void addCutGenerator(CglCutGenerator *generator, const char *name=NULL, BlisCutStrategy strategy=BlisCutStrategyAuto, int cutGenerationFrequency=1, bool normal=true, bool atSolution=false, bool whenInfeasible=false)
Add a Cgl cut generator.
double * startVarLB_
Starting var/con bounds for processing each node.
int numObjects() const
Get the number of objects.
int getNumIterations() const
Get how many iterations it took to solve the problem.
double objSense_
Objective function.
CoinMessages blisMessages()
Return messages.
OsiSolverInterface * lpSolver_
Actually used.
void addNumIterations(int newIter)
Increment Iteration count.
void setNumBranchResolve(int num)
Set the maximum number of resolve during branching.
const double * getColUpper()
Get column upper bound.
void addNumStrong(int num=1)
Add num to number of strong branchings.
double * incumbent_
Incumbent.
double getLpObjValue() const
Get current objective function value.
void passInPriorities(const int *priorities, bool ifNotSimpleIntegers, int defaultValue=1000)
Pass in branching priorities.
void packSharedVariables(AlpsEncoded *encoded)
Retrieve and pack shared variables.
void createIntgerObjects(bool startAgain)
Identify integer variable.
@ cutoffInc
The value added to relaxation value when deciding fathom.
BcpsObject * objects(int which)
Get the specified object.
const double * getLpSolution() const
Get active lp solution.
void setSolEstimate(double est)
int denseConCutoff_
Dense constraint cutoff.
void setConUb(double *cu)
Pass column lower bounds.
void packSharedPseudocost(AlpsEncoded *encoded, int numToShare)
Retrieve and pack shared pseudocost.
void setNumCons(int num)
Pass column upper bounds.
BlisHeuristic * heuristics(int i) const
Get a specific heuristic.
int cutGenerationFrequency_
Frequency of cut generation.
void deleteObjects()
Delete all object information.
virtual void postprocess()
Postprocessing the searching results.
int numCutGenerators() const
Get the number of cut generators.
double incObjValue_
Incumbent objective value.
virtual OsiSolverInterface * getSolver()
Get lp solver.
int numCols_
Number of columns/rows/elements.
BcpsConstraintPool * constraintPoolSend_
Constraints that can be sent/broadcasted to other processes.
BlisCutStrategy getCutStrategy() const
Query constraint generation strategy.
int storeSolution(BlisSolutionType how, BlisSolution *sol)
Record a new incumbent solution and update objectiveValue.
int maxNumCons_
Number of cuts can be generators.
virtual AlpsEncoded * encode() const
virtual void readInstance(const char *dataFile)
For parallel code, only the master calls this function.
double * varLB_
Variable and constraint bounds.
int getDenseConCutoff() const
Get the thresheld to be considered as a dense constraint.
virtual void setSolver(OsiSolverInterface *si)
Set lp solver.
void setNumElems(int num)
Pass column upper bounds.
int getNumHeurSolutions() const
Get number of heuristic solutions.
CoinMessageHandler * blisMessageHandler_
Message handler.
bool entry(const chrParams key) const
BcpsObject ** objects_
The set of objects.
double getCutoff() const
Get cut off value.
BcpsConstraintPool * constraintPool_
Store all the cuts.
BlisConstraint ** oldConstraints_
Temporary store old cuts at a node when installing a node.
virtual bool setupSelf()
All processes call this function.
int getAveIterations() const
Get the average iterations it took to solve a lp.
BlisHeurStrategy heurStrategy_
If use heuristics.
void setVarUb(double *ub)
Pass variable lower bounds.
double cutoffInc_
Cutoff increment.
void setColType(char *colType)
Pass variable types.
int numHeuristics() const
Get the number of heuristics.
AlpsTreeNode * activeNode_
Active node.
std::vector< BcpsVariable * > inputVar_
User's input objects.
BcpsObject ** objects()
Get the array of objects.
double * incumbent()
Return best ip solution found so far.
void setNumOldConstraints(int num)
Set number of old constraints.
int numIterations_
Number of lp(Simplex) iterations.
void setSolEstimate(double est)
Set the solution estimate of the active node.
double currRelGap_
Current relative optimal gap.
BlisParams * BlisPar_
Blis parameters.
double optimalAbsGap_
Input absolute optimal gap.
void setDenseConCutoff(int cutoff)
Set the thresheld to be considered as a dense constraint.
virtual void nodeLog(AlpsTreeNode *node, bool force)
Node log.
void setCutStrategy(BlisCutStrategy u)
Set constraint generation strategy.
bool checkInteger(double value) const
Check if a value is integer.
BlisHotStartStrategy hotstartStrategy_
void setActiveNode(AlpsTreeNode *node)
Set active node.
BcpsConstraintPool * constraintPoolReceive_
Constraints that are received from other processses.
double * startVarLB()
The starting variable bounds arrary of a subproblem (internal use).
int * tempVarLBPos_
Tempory storage for var/con indices.
OsiSolverInterface * origLpSolver_
Input by user.
AlpsReturnStatus decodeBlis(AlpsEncoded &encoded)
Unpack Blis portion of the model from an encoded object.
char * sharedObjectMark_
The objects that can be shared.
void addNumNodes(int newNodes=1)
Increment node count.
CoinMessages blisMessages_
Blis messages.
double optimalRelGap_
Input relative optimal gap.
void setMaxNumCons(int m)
Set the max number of cuts can be generated.
bool isRoot_
If root node.
int * getIntObjIndices() const
Get integers' object indices.
void setObjCoef(double *obj)
Pass objective coefficients.
int getNumStrong()
Get number of strong branchings.
virtual void readParameters(const int argnum, const char *const *arglist)
Read in Alps, Blis parameters.
void setColMatrix(CoinPackedMatrix *mat)
Pass a matrix in.
void addFeasCheckTime(double t)
Add to the time spent checking solutions for feasibility.
int getOldConstraintsSize() const
Get max number of old constraints.
BlisCutStrategy cutStrategy_
If use cut generators.
double feasCheckTime_
Time spent checking feasibility of solutions.
void unpackSharedPseudocost(AlpsEncoded &encoded)
Unpack and store shared pseduocost.
double integerTol_
Integer tolerance.
OsiCuts newCutPool_
Store new cuts in each pass.
OsiSolverInterface * presolvedLpSolver_
Presolved.
void setVarLb(double *lb)
Pass variable upper bounds.
void packSharedConstraints(AlpsEncoded *encoded)
Retrieve and pack shared constraints.
virtual ~BlisModel()
Destructor.
double * conLB()
Get original constraint bounds arrary.
virtual void importModel(std::vector< BlisVariable * > vars, std::vector< BlisConstraint * > cons)
For parallel code, only the master calls this function.
std::vector< BcpsConstraint * > inputCon_
const double * getColLower()
Get column lower bound.
double * conRandoms_
Random keys.
int getNumIntObjects() const
Get number of integers.
BlisSolution * feasibleSolutionHeur(const double *solution)
Test if a solution found by heuristic is feasible.
void setBranchingMethod(BcpsBranchStrategy *method)
Set the branching strategy.
BcpsBranchStrategy * rampUpBranchStrategy_
BcpsBranchStrategy * branchStrategy() const
Get the current branching strategy.
BlisParams * BlisPar()
Access parameters.
void gutsOfDestructor()
Actual destructor.
int getNumOldConstraints() const
Get number of old constraints.
double * startConLB()
The starting constraint bounds arrary of a subproblem (internal use).
int * getIntColIndices() const
Get integers' column indices.
void setConLb(double *cl)
Pass column upper bounds.
int aveIterations_
Average number of lp iterations to solve a subproblem.
void setNumVars(int num)
Pass column upper bounds.
void addCutGenerator(BlisConGenerator *generator)
Add a Blis cut generator.
BlisConstraint ** oldConstraints()
Access old constraints.
void setNumObjects(int num)
Set the number of objects.
int getNumCols()
Get number of columns.
int heurCallFrequency_
Frequency of using heuristics.
void setCutStrategy(int f)
Set constraint generation frequency.
virtual OsiSolverInterface * solver()
Get lp solver.
int * tempVarLBPos()
Temparory storage.
BlisModel()
Default construtor.
int * priority_
Priorities of integer object.
BlisHeuristic ** heuristics_
The list of heuristics.
virtual void modelLog()
Log of specific models.
virtual void preprocess()
Preprocessing the model.
virtual void unpackSharedKnowledge(AlpsEncoded &)
Unpack and store shared knowledge from an encoded object.
int getCutGenerationFrequency() const
Query constraint generation frequency.
int numCutGenerators_
Number of cut generators used.
int getNumNodes() const
Get how many Nodes it took to solve the problem.
CoinMessageHandler * blisMessageHandler() const
Get the message handler.
double getNodeWeight() const