BlisModel.h
Go to the documentation of this file.
1 /*===========================================================================*
2  * This file is part of the BiCePS Linear Integer Solver (BLIS). *
3  * *
4  * BLIS is distributed under the Eclipse Public License as part of the *
5  * COIN-OR repository (http://www.coin-or.org). *
6  * *
7  * Authors: *
8  * *
9  * Yan Xu, Lehigh University *
10  * Ted Ralphs, Lehigh University *
11  * *
12  * Conceptual Design: *
13  * *
14  * Yan Xu, Lehigh University *
15  * Ted Ralphs, Lehigh University *
16  * Laszlo Ladanyi, IBM T.J. Watson Research Center *
17  * Matthew Saltzman, Clemson University *
18  * *
19  * *
20  * Copyright (C) 2001-2013, Lehigh University, Yan Xu, and Ted Ralphs. *
21  * All Rights Reserved. *
22  *===========================================================================*/
23 
24 //#############################################################################
25 
26 #ifndef BlisModel_h_
27 #define BlisModel_h_
28 
29 //#############################################################################
30 
31 #include <vector>
32 
33 #include "CoinMpsIO.hpp"
34 #include "CoinLpIO.hpp"
35 #include "CoinPackedMatrix.hpp"
36 
37 #include "CglCutGenerator.hpp"
38 
39 #include "OsiCuts.hpp"
40 #include "OsiSolverInterface.hpp"
41 
42 #include "AlpsEnumProcessT.h"
43 #include "AlpsParams.h"
44 #include "AlpsTreeNode.h"
45 
46 #include "BcpsBranchStrategy.h"
47 #include "BcpsObject.h"
48 #include "BcpsObjectPool.h"
49 #include "BcpsModel.h"
50 
51 #include "Blis.h"
52 #include "BlisConGenerator.h"
53 #include "BlisHeuristic.h"
54 #include "BlisMessage.h"
55 #include "BlisParams.h"
56 #include "BlisPseudo.h"
57 #include "BlisPresolve.h"
58 
59 //#############################################################################
60 
61 class BlisConstraint;
62 class BlisSolution;
63 class BcpsVariable;
64 class BlisVariable;
65 
66 //#############################################################################
67 
68 /* Declare a BLIS model */
69 class BlisModel : public BcpsModel {
70 
71 protected:
72 
73  //------------------------------------------------------
74  // LP SOLVER.
75  //------------------------------------------------------
76 
84 
85  //------------------------------------------------------
86  // PROBLEM DATA. Populate when loadProblem(),
87  //------------------------------------------------------
88 
91 
94  double *varLB_;
95  double *varUB_;
96  double *conLB_;
97  double *conUB_;
99 
102  int numCols_;
103  int numRows_;
104  int numElems_;
106 
109  double objSense_;
110  double *objCoef_;
112 
116  int *intColIndices_; // size of numIntObjects_
118 
121  std::vector<BcpsVariable *> inputVar_;
122  std::vector<BcpsConstraint *> inputCon_;
124 
125  //------------------------------------------------------
126  // PRESOLVE
127  //------------------------------------------------------
128 
130  // AT - Begin
131  bool presolved;
133  // AT - End
134 
135  //------------------------------------------------------
136  // SOLUTION.
137  //------------------------------------------------------
138 
139  int numSolutions_;
140  int numHeurSolutions_;
141 
143  double incObjValue_;
144 
146  double *incumbent_;
147 
149  double cutoff_;
150 
152  double cutoffInc_;
153 
154  //------------------------------------------------------
155  // SEARCHING.
156  //------------------------------------------------------
157 
158  int *intObjIndices_; // size of numCols_
159  char *colType_;
160 
163  double *startVarLB_;
164  double *startVarUB_;
165  double *startConLB_;
166  double *startConUB_;
168 
172 
173  // Hotstart strategy 0 = off,
174  // 1 = branch if incorrect,
175  // 2 = branch even if correct, ....
177 
179  int numObjects_;
180 
183 
186 
188  int *priority_;
189 
192 
194  int numStrong_;
195 
196  // Not used.
197  double nodeWeight_;
198 
201 
202  //------------------------------------------------------
203  // HEURISTICS.
204  //------------------------------------------------------
205 
207  int numHeuristics_;
208 
211 
212  //------------------------------------------------------
213  // CONSTRAINTS.
214  //------------------------------------------------------
215 
218 
221 
223  int numCutGenerators_;
224 
226  int maxNumCons_;
227 
230 
233 
236 
239 
241  int numOldConstraints_;
242 
244  double *conRandoms_;
245 
247  int denseConCutoff_;
248 
249  //------------------------------------------------------
250  // PARAMETERS, STATISTICS, and MESSAGE
251  //------------------------------------------------------
252 
255 
258 
261 
263  int numNodes_;
264 
266  int numIterations_;
267 
269  int aveIterations_;
270 
271  //------------------------------------------------------
272  // TEMPORARY STORAGE
273  //------------------------------------------------------
274 
277  int *tempVarLBPos_;
278  int *tempVarUBPos_;
279  int *tempConLBPos_;
280  int *tempConUBPos_;
282 
283  //------------------------------------------------------
284  // Knowledge shared
285  //------------------------------------------------------
286 
289 
292 
293  public:
294 
296  bool isRoot_;
297 
300 
302  double integerTol_;
303 
305  double optimalRelGap_;
306 
308  double optimalAbsGap_;
309 
311  double currRelGap_;
312 
314  double currAbsGap_;
315 
318 
321 
324 
326  std::vector<AlpsTreeNode *> leafToRootPath;
327 
328  protected:
329 
331  void init();
332 
334  void createObjects();
335 
336  public:
337 
340  {
341  init();
342  }
343 
345  virtual ~BlisModel();
346 
348  void gutsOfDestructor();
349 
350  //------------------------------------------------------
351  // SETUP, LP SOLVER
352  //------------------------------------------------------
353 
356 
358  void setNumCons(int num){ numRows_ = num; }
359 
361  void setNumVars(int num){ numCols_ = num; }
362 
364  void setNumElems(int num){ numElems_ = num; }
365 
367  void setConLb(double *cl){ conLB_ = cl; }
368 
370  void setConUb(double *cu){ conUB_ = cu; }
371 
373  void setVarLb(double *lb){ varLB_ = lb; }
374 
376  void setVarUb(double *ub){ varUB_ = ub; }
377 
379  void setColType(char *colType){
380  colType_ = colType;
381  }
382 
384  void setObjCoef(double *obj){ objCoef_ = obj; }
385 
395  virtual void readInstance(const char* dataFile);
396 
408  virtual void importModel(std::vector<BlisVariable *> vars,
409  std::vector<BlisConstraint *> cons);
410 
412  virtual void readParameters(const int argnum, const char * const *arglist);
413 
415  virtual void writeParameters(std::ostream& outstream) const;
416 
420  virtual AlpsTreeNode * createRoot();
421 
431  virtual bool setupSelf();
432 
434  virtual void preprocess();
435 
437  virtual void postprocess();
438 
440  virtual void setSolver(OsiSolverInterface *si) { origLpSolver_ = si; }
441 
444 
446  virtual OsiSolverInterface *solver() { return lpSolver_; }
447 
449  bool resolve();
450 
452  void setActiveNode(AlpsTreeNode *node) { activeNode_ = node; }
453 
455  void setSolEstimate(double est) { activeNode_->setSolEstimate(est); }
456 
458  int getNumStrong() { return numStrong_; }
459 
461  void addNumStrong(int num=1) { numStrong_ += num; }
462 
465 
467  void setNumBranchResolve(int num) { numBranchResolve_ = num; }
468 
469  //------------------------------------------------------
470  // PROBLEM DATA
471  //------------------------------------------------------
472 
474  double* getObjCoef() const { return objCoef_; }
475 
477  const double * getColLower() { return lpSolver_->getColLower(); }
478 
480  const double * getColUpper() { return lpSolver_->getColUpper(); }
481 
483  int getNumCols() { return lpSolver_->getNumCols(); }
484 
486  int getNumRows() { return lpSolver_->getNumRows(); }
487 
489  double *varLB() { return varLB_; }
490  double *varUB() { return varUB_; }
491 
493  double *conLB() { return conLB_; }
494  double *conUB() { return conUB_; }
495 
497  double *startVarLB() { return startVarLB_; }
498  double *startVarUB() { return startVarUB_; }
499 
501  double *startConLB() { return startConLB_; }
502  double *startConUB() { return startConUB_; }
503 
505  int *tempVarLBPos() { return tempVarLBPos_; }
506  int *tempVarUBPos() { return tempVarUBPos_; }
507  int *tempConLBPos() { return tempConLBPos_; }
508  int *tempConUBPos() { return tempConUBPos_; }
509 
510  //------------------------------------------------------
511  // LP SOLUTION
512  //------------------------------------------------------
513 
515  double getLpObjValue() const { return lpSolver_->getObjValue(); }
516 
518  const double * getLpSolution() const { return lpSolver_->getColSolution();}
519 
520  //------------------------------------------------------
521  // MILP SOLUTION
522  //------------------------------------------------------
523 
525  int getNumSolutions() const { return numSolutions_; }
526 
528  int getNumHeurSolutions() const { return numHeurSolutions_;}
529 
531  double * incumbent() { return incumbent_; }
532 
535 
537  inline double getCutoff() const { return cutoff_; }
538 
540  inline void setCutoff(double co) {
541  double inc = BlisPar_->entry(BlisParams::cutoffInc);
542 #if 0
543  std::cout << "3. cutoff_ = "<< cutoff_
544  << "; inc = " << inc << std::endl;
545 #endif
546  co += inc;
547  if (co < cutoff_) {
548  cutoff_ = co;
550  }
551  }
552 
554  BlisSolution *feasibleSolutionHeur(const double *solution);
555 
560  virtual BlisSolution *feasibleSolution(int & numIntegerInfs,
561  int & numObjectInfs);
562 
571  virtual BlisSolution *userFeasibleSolution(const double * solution,
572  bool &feasible) {
573  BlisSolution *sol = NULL;
574  feasible = true; // Feasible by default
575  return sol;
576  }
577 
578  //------------------------------------------------------
579  // BRANCHING
580  //------------------------------------------------------
581 
588  { return branchStrategy_; }
589 
591  inline void setBranchingMethod(BcpsBranchStrategy * method) {
592  if (branchStrategy_) delete branchStrategy_;
593  branchStrategy_ = method;
594  }
595 
597  inline void setBranchingMethod(BcpsBranchStrategy & method) {
598  if (branchStrategy_) delete branchStrategy_;
599  branchStrategy_ = &method;
600  }
602  { return rampUpBranchStrategy_; }
604 
609  inline int numObjects() const { return numObjects_; }
610 
612  inline void setNumObjects(int num) { numObjects_ = num; }
613 
615  inline BcpsObject ** objects() { return objects_;}
616 
618  inline BcpsObject * objects(int which) { return objects_[which]; }
619 
621  void setSharedObjectMark(int i) { sharedObjectMark_[i] = 1; }
622 
625  for (int k = 0; k < numIntObjects_; ++k) {
626  sharedObjectMark_[k] = 0;
627  }
628  }
629 
631  void deleteObjects();
632 
635  void addObjects(int numObjects, BcpsObject ** objects);
637 
639  void createIntgerObjects(bool startAgain);
640 
642  int* getIntObjIndices() const { return intObjIndices_; }
643 
645  int getNumIntObjects() const { return numIntObjects_; }
646 
648  int* getIntColIndices() const { return intColIndices_; }
649 
651  bool checkInteger(double value) const {
652  double integerTolerance = 1.0e-5;
653  double nearest = floor(value + 0.5);
654  if (fabs(value - nearest) <= integerTolerance) {
655  return true;
656  }
657  else {
658  return false;
659  }
660  }
661 
662  void analyzeObjective();
663 
664  //------------------------------------------------------
665  // HEURISTICS.
666  //------------------------------------------------------
667 
669  void addHeuristic(BlisHeuristic * heur);
670 
672  BlisHeuristic * heuristics(int i) const { return heuristics_[i]; }
673 
675  int numHeuristics() const { return numHeuristics_; }
676 
677  //------------------------------------------------------
678  // CONSTRAINTS.
679  //------------------------------------------------------
680 
682  void addCutGenerator(BlisConGenerator * generator);
683 
685  void addCutGenerator(CglCutGenerator * generator,
686  const char * name = NULL,
688  int cutGenerationFrequency = 1,
689  bool normal = true,
690  bool atSolution = false,
691  bool whenInfeasible = false);
692 
694  BlisConGenerator *cutGenerators(int i) const { return generators_[i]; }
695 
697  int numCutGenerators() const { return numCutGenerators_; }
698 
700  int getMaxNumCons() const { return maxNumCons_; }
701 
703  void setMaxNumCons(int m) { maxNumCons_ = m; }
704 
707 
710  { return constraintPoolReceive_; }
711 
714 
716 
717  int getNumOldConstraints() const { return numOldConstraints_; }
718 
720  void setNumOldConstraints(int num) { numOldConstraints_ = num; }
721 
724 
727 
730 
733 
736  delete [] oldConstraints_;
737  oldConstraints_ = NULL;
738  }
740 
743  return cutStrategy_;
744  }
745 
748 
751 
754 
756  int getDenseConCutoff() const { return denseConCutoff_; }
757 
759  void setDenseConCutoff(int cutoff) { denseConCutoff_ = cutoff; }
760 
762  double *getConRandoms() const { return conRandoms_; }
763 
764  //------------------------------------------------------
765  // PRIORITY AND WEITGHT.
766  //------------------------------------------------------
767 
782  void passInPriorities(const int * priorities,
783  bool ifNotSimpleIntegers,
784  int defaultValue = 1000);
785 
787  inline const int * priority() const { return priority_; }
788 
790  inline int priority(int sequence) const {
791  if (priority_) return priority_[sequence];
792  else return 1000;
793  }
794 
795  inline double getNodeWeight() const { return nodeWeight_; }
796 
797  inline void setNodeWeight(double nw) { nodeWeight_ = nw; }
799 
800  //------------------------------------------------------
801  // STATISTICS.
802  //------------------------------------------------------
803 
805  virtual void modelLog();
806 
808  int getNumNodes() const { return numNodes_; }
809 
811  int getNumIterations() const { return numIterations_; }
812 
814  int getAveIterations() const { return aveIterations_; }
815 
817  void addNumNodes(int newNodes = 1) { numNodes_ += newNodes; }
818 
820  void addNumIterations(int newIter) {
821  numIterations_ += newIter;
823  }
824 
827  { return blisMessageHandler_; }
828 
831 
834  BlisParams * BlisPar() { return BlisPar_; }
836 
838  virtual void nodeLog(AlpsTreeNode *node, bool force);
839 
841  virtual bool fathomAllNodes();
842 
843  //------------------------------------------------------
844  // PARALLEL
845  //------------------------------------------------------
846 
847  protected:
848 
850  AlpsReturnStatus encodeBlis(AlpsEncoded *encoded) const;
851 
854 
856  void packSharedPseudocost(AlpsEncoded *encoded, int numToShare);
857 
859  void unpackSharedPseudocost(AlpsEncoded &encoded);
860 
862  void packSharedConstraints(AlpsEncoded *encoded);
863 
865  void unpackSharedConstraints(AlpsEncoded &encoded);
866 
868  void packSharedVariables(AlpsEncoded *encoded);
869 
871  void unpackSharedVariables(AlpsEncoded &encoded);
872 
873  public:
874 
877  virtual void registerKnowledge();
878 
879  using AlpsKnowledge::encode ;
881  virtual AlpsEncoded* encode() const;
882 
884  virtual void decodeToSelf(AlpsEncoded&);
885 
888  virtual AlpsEncoded* packSharedKnowlege();
889 
891  virtual void unpackSharedKnowledge(AlpsEncoded&);
892 
893  //AT - Begin
894  virtual void presolveForTheWholeTree();
895  //AT - end
896 };
897 
898 #endif /* End of file */
double * startVarLB()
The starting variable bounds arrary of a subproblem (internal use).
Definition: BlisModel.h:497
int numHeuristics() const
Get the number of heuristics.
Definition: BlisModel.h:675
virtual bool fathomAllNodes()
Return true, if all nodes can be fathomed.
BlisHotStartStrategy
Definition: Blis.h:95
void createIntgerObjects(bool startAgain)
Identify integer variable.
BlisHeurStrategy
Definition: Blis.h:77
OsiSolverInterface * presolvedLpSolver_
Presolved.
Definition: BlisModel.h:80
BcpsBranchStrategy * rampUpBranchStrategy_
Definition: BlisModel.h:171
void setSharedObjectMark(int i)
Mark object to be shared.
Definition: BlisModel.h:621
double cutoffInc_
Cutoff increment.
Definition: BlisModel.h:127
double optimalAbsGap_
Absolute optimal gap.
Definition: BlisModel.h:260
int heurCallFrequency_
Frequency of using heuristics.
Definition: BlisModel.h:320
int * intObjIndices_
Definition: BlisModel.h:158
int getNumStrong()
Get number of strong branchings.
Definition: BlisModel.h:458
double * startConUB_
Starting var/con bounds for processing each node.
Definition: BlisModel.h:138
A interface to Osi/Coin Presolve.
Definition: BlisPresolve.h:37
void delOldConstraints()
Set max number of old constraints.
Definition: BlisModel.h:735
double nodeWeight_
Definition: BlisModel.h:165
virtual AlpsEncoded * packSharedKnowlege()
Pack knowledge to be shared with others into an encoded object.
int numOldConstraints_
Number of old constraints.
Definition: BlisModel.h:203
BlisConGenerator * cutGenerators(int i) const
Get a specific cut generator.
Definition: BlisModel.h:694
int numStrong_
Number of strong branching.
Definition: BlisModel.h:162
CoinMessageHandler * blisMessageHandler() const
Get the message handler.
Definition: BlisModel.h:826
BlisHotStartStrategy hotstartStrategy_
Definition: BlisModel.h:176
Base class for message handling.
BlisPresolve * presolve_
Definition: BlisModel.h:129
BlisParams * BlisPar()
Access parameters.
Definition: BlisModel.h:834
int numObjects() const
Get the number of objects.
Definition: BlisModel.h:609
int numObjects_
Number of objects.
Definition: BlisModel.h:150
void analyzeObjective()
BlisHeuristic * heuristics(int i) const
Get a specific heuristic.
Definition: BlisModel.h:672
BcpsObject ** objects_
The set of objects.
Definition: BlisModel.h:153
double * startConLB_
Starting var/con bounds for processing each node.
Definition: BlisModel.h:137
int denseConCutoff_
Dense constraint cutoff.
Definition: BlisModel.h:209
virtual void nodeLog(AlpsTreeNode *node, bool force)
Node log.
int getNumHeurSolutions() const
Get number of heuristic solutions.
Definition: BlisModel.h:528
bool feasibleSolution(int &numIntegerInfs)
Test the current lp solution for feasiblility.
double getNodeWeight() const
Definition: BlisModel.h:795
BcpsConstraintPool * constraintPool()
Access constraint pool.
Definition: BlisModel.h:706
int numIntObjects_
Column types.
Definition: BlisModel.h:115
std::vector< AlpsTreeNode * > leafToRootPath
Record the path from leaf to root.
Definition: BlisModel.h:271
AlpsReturnStatus
Definition: Alps.h:118
const double * getColUpper()
Get column upper bound.
Definition: BlisModel.h:480
Heuristic base class.
Definition: BlisHeuristic.h:46
int getNumOldConstraints() const
Get number of old constraints.
Definition: BlisModel.h:717
int getAveIterations() const
Get the average iterations it took to solve a lp.
Definition: BlisModel.h:814
virtual void readInstance(const char *dataFile)
Read in the instance data.
int numSolutions_
Definition: BlisModel.h:111
int numCutGenerators() const
Get the number of cut generators.
Definition: BlisModel.h:697
int getMaxNumCons() const
Get the max number of cuts can be generated.
Definition: BlisModel.h:700
virtual const double * getColUpper() const =0
Get a pointer to an array[getNumCols()] of column upper bounds.
virtual int getNumCols() const =0
Get the number of columns.
void setSolEstimate(double est)
Set the solution estimate of the active node.
Definition: BlisModel.h:455
int * getIntColIndices() const
Get integers&#39; column indices.
Definition: BlisModel.h:648
virtual AlpsEncoded * encode() const
The method that encodes the model into a encoded object.
A class for describing the objects that comprise a BCPS subproblem.
Definition: BcpsObject.h:76
virtual void importModel(std::vector< BlisVariable * > vars, std::vector< BlisConstraint * > cons)
For parallel code, only the master calls this function.
OsiSolverInterface * lpSolver_
Lp solver.
Definition: BlisModel.h:69
BlisHeurStrategy heurStrategy_
If use heuristics.
Definition: BlisModel.h:317
void setBranchingMethod(BcpsBranchStrategy &method)
Set the branching stratedy.
Definition: BlisModel.h:597
int maxNumCons_
Number of cuts can be generators.
Definition: BlisModel.h:188
Sparse Matrix Base Class.
virtual ~BlisModel()
Destructor.
BcpsConstraintPool * constraintPoolSend()
Access send constraint pool.
Definition: BlisModel.h:713
int getDenseConCutoff() const
Get the thresheld to be considered as a dense constraint.
Definition: BlisModel.h:756
double getLpObjValue() const
Get current objective function value.
Definition: BlisModel.h:515
void init()
Intialize member data.
BcpsConstraintPool * constraintPoolReceive()
Access receive constraint pool.
Definition: BlisModel.h:709
std::vector< BcpsVariable * > inputVar_
User&#39;s input objects.
Definition: BlisModel.h:121
double * getObjCoef() const
Get objective coefficients.
Definition: BlisModel.h:474
int storeSolution(BlisSolutionType how, BlisSolution *sol)
Record a new incumbent solution and update objectiveValue.
int numCutGenerators_
Number of cut generators used.
Definition: BlisModel.h:185
AlpsTreeNode * activeNode_
Active node.
Definition: BlisModel.h:159
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
double * startConUB()
Definition: BlisModel.h:502
void addObjects(int numObjects, BcpsObject **objects)
Add in object information.
This data structure is to contain the packed form of an encodable knowledge.
Definition: AlpsEncoded.h:25
bool checkInteger(double value) const
Check if a value is integer.
Definition: BlisModel.h:651
double * startVarUB_
Starting var/con bounds for processing each node.
Definition: BlisModel.h:136
void setBranchingMethod(BcpsBranchStrategy *method)
Set the branching strategy.
Definition: BlisModel.h:591
int getNumNodes() const
Get how many Nodes it took to solve the problem.
Definition: BlisModel.h:808
int * tempVarLBPos()
Temparory storage.
Definition: BlisModel.h:505
double * startVarLB_
Starting var/con bounds for processing each node.
Definition: BlisModel.h:135
int * tempConLBPos()
Definition: BlisModel.h:507
double currAbsGap_
Current absolute optimal gap.
Definition: BlisModel.h:314
int getNumBranchResolve()
Get the maximum number of resolve during branching.
Definition: BlisModel.h:464
void setSolEstimate(double est)
Query/set the solution estimate of the node.
Definition: AlpsTreeNode.h:217
double optimalRelGap_
Relative optimal gap.
Definition: BlisModel.h:257
void addCutGenerator(CglCutGenerator *generator, const char *name=NULL, int strategy=0, bool normal=true, bool atSolution=false, bool whenInfeasible=false)
Add a cut generator.
void setNumOldConstraints(int num)
Set number of old constraints.
Definition: BlisModel.h:720
char * colType_
Column types.
Definition: BlisModel.h:104
void setNumVars(int num)
Pass column upper bounds.
Definition: BlisModel.h:361
double * varLB()
Get variable bounds arrary.
Definition: BlisModel.h:489
void setNumBranchResolve(int num)
Set the maximum number of resolve during branching.
Definition: BlisModel.h:467
BlisCutStrategy cutStrategy_
If use cut generators.
Definition: BlisModel.h:217
virtual double getObjValue() const =0
Get the objective function value.
void setConUb(double *cu)
Pass column lower bounds.
Definition: BlisModel.h:370
int numHeuristics_
Number of heuristics.
Definition: BlisModel.h:172
double * conRandoms_
Random keys.
Definition: BlisModel.h:206
CoinPackedMatrix * colMatrix_
Orignial column majored matrix.
Definition: BlisModel.h:76
Interface between Blis and Cut Generation Library.
BlisCutStrategy
Definition: Blis.h:69
void setMaxNumCons(int m)
Set the max number of cuts can be generated.
Definition: BlisModel.h:703
This class holds one node of the search tree.
Definition: AlpsTreeNode.h:50
double cutoff_
Cutoff in lp solver.
Definition: BlisModel.h:124
void unpackSharedPseudocost(AlpsEncoded &encoded)
Unpack and store shared pseduocost.
int numHeurSolutions_
Definition: BlisModel.h:112
virtual int getNumRows() const =0
Get the number of rows.
std::vector< BcpsConstraint * > inputCon_
User&#39;s input objects.
Definition: BlisModel.h:122
BcpsObject * objects(int which)
Get the specified object.
Definition: BlisModel.h:618
The value added to relaxation value when deciding fathom.
Definition: BlisParams.h:103
void unpackSharedVariables(AlpsEncoded &encoded)
Unpack and store shared variables.
int * tempConUBPos()
Definition: BlisModel.h:508
void setNodeWeight(double nw)
Definition: BlisModel.h:797
virtual OsiSolverInterface * solver()
Get lp solver.
Definition: BlisModel.h:446
virtual const double * getColLower() const =0
Get a pointer to an array[getNumCols()] of column lower bounds.
int * tempConLBPos_
Tempory storage for var/con indices.
Definition: BlisModel.h:238
BcpsBranchStrategy * rampUpBranchStrategy() const
Get the current branching strategy.
Definition: BlisModel.h:601
virtual bool setupSelf()
Do necessary work to make model usable.
virtual const double * getColSolution() const =0
Get a pointer to an array[getNumCols()] of primal variable values.
int priority(int sequence) const
Returns priority level for an object (or 1000 if no priorities exist)
Definition: BlisModel.h:790
BlisSolution * feasibleSolutionHeur(const double *solution)
Test if a solution found by heuristic is feasible.
double currRelGap_
Current relative optimal gap.
Definition: BlisModel.h:311
double getCutoff() const
Get cut off value.
Definition: BlisModel.h:537
void setNumElems(int num)
Pass column upper bounds.
Definition: BlisModel.h:364
BlisModel()
Default construtor.
Definition: BlisModel.h:339
double * conLB_
Variable and constraint bounds.
Definition: BlisModel.h:96
double * varLB_
Variable and constraint bounds.
Definition: BlisModel.h:94
int cutGenerationFrequency_
Frequency of cut generation.
Definition: BlisModel.h:220
int getNumSolutions() const
Get number of solutions.
Definition: BlisModel.h:525
bool presolved
Definition: BlisModel.h:131
void packSharedPseudocost(AlpsEncoded *encoded, int numToShare)
Retrieve and pack shared pseudocost.
BcpsBranchStrategy * branchStrategy() const
Get the current branching strategy.
Definition: BlisModel.h:587
int numIterations_
Number of lp(Simplex) iterations.
Definition: BlisModel.h:225
double objSense_
Objective function.
Definition: BlisModel.h:96
int oldConstraintsSize_
The memory size allocated for oldConstraints_.
Definition: BlisModel.h:200
This class contains the solutions generated by the LP solver (either primal or dual.
Definition: BlisSolution.h:36
void clearSharedObjectMark()
Clear all the share mark.
Definition: BlisModel.h:624
CoinMessages blisMessages()
Return messages.
Definition: BlisModel.h:830
Abstract Base Class for describing an interface to a solver.
double * objCoef_
Objective function.
Definition: BlisModel.h:97
int numElems_
Number of columns/rows/elements in active subproblem.
Definition: BlisModel.h:91
virtual void presolveForTheWholeTree()
int * tempVarUBPos_
Tempory storage for var/con indices.
Definition: BlisModel.h:237
Branching strategy specifies: (1) how to select a candidate set of branching objects (2) how to compa...
double * varUB_
Variable and constraint bounds.
Definition: BlisModel.h:95
void setDenseConCutoff(int cutoff)
Set the thresheld to be considered as a dense constraint.
Definition: BlisModel.h:759
double incObjValue_
Saved lp solution for temporatory usage.
Definition: BlisModel.h:118
double * conUB()
Definition: BlisModel.h:494
Cut Generator Base Class.
double * incumbent_
Incumbent.
Definition: BlisModel.h:121
double * startConLB()
The starting constraint bounds arrary of a subproblem (internal use).
Definition: BlisModel.h:501
void packSharedVariables(AlpsEncoded *encoded)
Retrieve and pack shared variables.
void unpackSharedConstraints(AlpsEncoded &encoded)
Unpack and store shared constraints.
int getNumIntObjects() const
Get number of integers.
Definition: BlisModel.h:645
BlisCutStrategy getCutStrategy() const
Query constraint generation strategy.
Definition: BlisModel.h:742
virtual void modelLog()
Log of specific models.
void gutsOfDestructor()
Actual destructor.
virtual void setSolver(OsiSolverInterface *si)
Set lp solver.
Definition: BlisModel.h:440
int * tempVarLBPos_
Tempory storage for var/con indices.
Definition: BlisModel.h:236
BlisConGenerator ** generators_
The list of cut generators used.
Definition: BlisModel.h:191
void setCutoff(double co)
Set cut off value.
Definition: BlisModel.h:540
virtual AlpsTreeNode * createRoot()
Create the root node based on model.
char * sharedObjectMark_
The objects that can be shared.
Definition: BlisModel.h:185
virtual void postprocess()
Postprocessing the searching results.
OsiCuts newCutPool_
Store new cuts in each pass.
Definition: BlisModel.h:266
BcpsBranchStrategy * branchStrategy_
Variable selection function.
Definition: BlisModel.h:142
void createObjects()
Create variables and constraints.
void setOldConstraintsSize(int num)
Set max number of old constraints.
Definition: BlisModel.h:726
BcpsConstraintPool * constraintPoolReceive_
Constraints that are received from other processses.
Definition: BlisModel.h:291
Class to hold and manipulate an array of massaged messages.
int getNumRows()
Get number of rows.
Definition: BlisModel.h:486
int numCols_
Number of columns/rows/elements in active subproblem.
Definition: BlisModel.h:89
int numNodes_
Number of processed nodes.
Definition: BlisModel.h:222
int * intColIndices_
Column types.
Definition: BlisModel.h:116
double * getConRandoms() const
Get randoms for check parallel constraints.
Definition: BlisModel.h:762
double * incumbent()
Return best ip solution found so far.
Definition: BlisModel.h:531
void setVarUb(double *ub)
Pass variable lower bounds.
Definition: BlisModel.h:376
BlisConstraint ** oldConstraints()
Access old constraints.
Definition: BlisModel.h:729
BcpsObject ** objects()
Get the array of objects.
Definition: BlisModel.h:615
int aveIterations_
Average number of lp iterations to solve a subproblem.
Definition: BlisModel.h:228
int getCutGenerationFrequency() const
Query constraint generation frequency.
Definition: BlisModel.h:750
int * getIntObjIndices() const
Get integers&#39; object indices.
Definition: BlisModel.h:642
int * tempVarUBPos()
Definition: BlisModel.h:506
int getOldConstraintsSize() const
Get max number of old constraints.
Definition: BlisModel.h:723
int boundingPass_
The number of passes during bounding procedure.
Definition: BlisModel.h:299
void setNumCons(int num)
Pass column upper bounds.
Definition: BlisModel.h:358
void setConLb(double *cl)
Pass column upper bounds.
Definition: BlisModel.h:367
void setVarLb(double *lb)
Pass variable upper bounds.
Definition: BlisModel.h:373
virtual void preprocess()
Preprocessing the model.
AlpsReturnStatus decodeBlis(AlpsEncoded &encoded)
Unpack Blis portion of the model from an encoded object.
BcpsConstraintPool * constraintPoolSend_
Constraints that can be sent/broadcasted to other processes.
Definition: BlisModel.h:288
int * priority_
Priorities of integer object.
Definition: BlisModel.h:156
void setOldConstraints(BlisConstraint **old)
set old constraints.
Definition: BlisModel.h:732
void packSharedConstraints(AlpsEncoded *encoded)
Retrieve and pack shared constraints.
void passInPriorities(const int *priorities, bool ifNotSimpleIntegers, int defaultValue=1000)
Pass in branching priorities.
BlisHeuristic ** heuristics_
The list of heuristics.
Definition: BlisModel.h:175
virtual OsiSolverInterface * getSolver()
Get lp solver.
Definition: BlisModel.h:443
void setObjCoef(double *obj)
Pass objective coefficients.
Definition: BlisModel.h:384
bool isRoot_
If root node.
Definition: BlisModel.h:245
void addNumNodes(int newNodes=1)
Increment node count.
Definition: BlisModel.h:817
void setCutStrategy(int f)
Set constraint generation frequency.
Definition: BlisModel.h:753
double * conLB()
Get original constraint bounds arrary.
Definition: BlisModel.h:493
bool entry(const boolParams key) const
Definition: BlisParams.h:192
BlisParams * BlisPar_
Blis parameters.
Definition: BlisModel.h:216
void addNumIterations(int newIter)
Increment Iteration count.
Definition: BlisModel.h:820
AlpsReturnStatus encodeBlis(AlpsEncoded *encoded) const
Pack Blis portion of the model into an encoded object.
virtual void decodeToSelf(AlpsEncoded &)
The method that decodes the model from a encoded object.
void setColMatrix(CoinPackedMatrix *mat)
Pass a matrix in.
Definition: BlisModel.h:355
CoinMessageHandler * blisMessageHandler_
Message handler.
Definition: BlisModel.h:257
void addNumStrong(int num=1)
Add num to number of strong branchings.
Definition: BlisModel.h:461
void deleteObjects()
Delete all object information.
bool resolve()
Resolving a lp.
void setCutStrategy(BlisCutStrategy u)
Set constraint generation strategy.
Definition: BlisModel.h:747
void addHeuristic(BlisHeuristic *heur)
Add a heuristic.
virtual void unpackSharedKnowledge(AlpsEncoded &)
Unpack and store shared knowledge from an encoded object.
OsiSolverInterface * origLpSolver_
Input by user.
Definition: BlisModel.h:78
int getNumCols()
Get number of columns.
Definition: BlisModel.h:483
BlisConstraint ** oldConstraints_
Temporary store old cuts at a node when installing a node.
Definition: BlisModel.h:197
BcpsConstraintPool * constraintPool_
Store all the cuts.
Definition: BlisModel.h:194
virtual void writeParameters(std::ostream &outstream) const
Write out parameters.
BlisSolutionType
Definition: Blis.h:112
CoinMessages blisMessages_
Blis messages.
Definition: BlisModel.h:260
const double * getColLower()
Get column lower bound.
Definition: BlisModel.h:477
const double * getLpSolution() const
Get active lp solution.
Definition: BlisModel.h:518
int numBranchResolve_
Maximum number of resolve during branching.
Definition: BlisModel.h:200
const int * priority() const
Priorities.
Definition: BlisModel.h:787
virtual void registerKnowledge()
Register knowledge.
virtual bool setDblParam(OsiDblParam key, double value)
Set a double parameter.
virtual AlpsEncoded * encode() const
This method should encode the content of the object and return a pointer to the encoded form...
double * startVarUB()
Definition: BlisModel.h:498
void setColType(char *colType)
Pass variable types.
Definition: BlisModel.h:379
double * conUB_
Variable and constraint bounds.
Definition: BlisModel.h:97
Dual objective limit.
int * tempConUBPos_
Tempory storage for var/con indices.
Definition: BlisModel.h:239
int getNumIterations() const
Get how many iterations it took to solve the problem.
Definition: BlisModel.h:811
virtual void readParameters(const int argnum, const char *const *arglist)
Read in Alps, Blis parameters.
int numRows_
Number of columns/rows/elements in active subproblem.
Definition: BlisModel.h:90
double * varUB()
Definition: BlisModel.h:490
bool problemSetup
Definition: BlisModel.h:132
double integerTol_
Integer tolerance.
Definition: BlisModel.h:254
void setActiveNode(AlpsTreeNode *node)
Set active node.
Definition: BlisModel.h:452
virtual BlisSolution * userFeasibleSolution(const double *solution, bool &feasible)
User&#39;s criteria for a feasible solution.
Definition: BlisModel.h:571
void setNumObjects(int num)
Set the number of objects.
Definition: BlisModel.h:612