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