- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
78 OsiSolverInterface *origLpSolver_;
80 OsiSolverInterface *presolvedLpSolver_;
83 OsiSolverInterface *lpSolver_;
84
85 //------------------------------------------------------
86 // PROBLEM DATA. Populate when loadProblem(),
87 //------------------------------------------------------
88
90 CoinPackedMatrix *colMatrix_;
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
115 int numIntObjects_;
116 int *intColIndices_; // size of numIntObjects_
118
121 std::vector<BcpsVariable *> inputVar_;
122 std::vector<BcpsConstraint *> inputCon_;
124
125 //------------------------------------------------------
126 // PRESOLVE
127 //------------------------------------------------------
128
129 BlisPresolve *presolve_;
130 // AT - Begin
131 bool presolved;
132 bool problemSetup;
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
170 BcpsBranchStrategy * branchStrategy_;
171 BcpsBranchStrategy * rampUpBranchStrategy_;
172
173 // Hotstart strategy 0 = off,
174 // 1 = branch if incorrect,
175 // 2 = branch even if correct, ....
176 BlisHotStartStrategy hotstartStrategy_;
177
179 int numObjects_;
180
182 BcpsObject **objects_;
183
185 char *sharedObjectMark_;
186
188 int *priority_;
189
191 AlpsTreeNode *activeNode_;
192
194 int numStrong_;
195
196 // Not used.
197 double nodeWeight_;
198
200 int numBranchResolve_;
201
202 //------------------------------------------------------
203 // HEURISTICS.
204 //------------------------------------------------------
205
207 int numHeuristics_;
208
210 BlisHeuristic **heuristics_;
211
212 //------------------------------------------------------
213 // CONSTRAINTS.
214 //------------------------------------------------------
215
217 BlisCutStrategy cutStrategy_;
218
220 int cutGenerationFrequency_;
221
223 int numCutGenerators_;
224
226 int maxNumCons_;
227
229 BlisConGenerator **generators_;
230
232 BcpsConstraintPool *constraintPool_;
233
235 BlisConstraint **oldConstraints_;
236
238 int oldConstraintsSize_;
239
241 int numOldConstraints_;
242
244 double *conRandoms_;
245
247 int denseConCutoff_;
248
249 //------------------------------------------------------
250 // PARAMETERS, STATISTICS, and MESSAGE
251 //------------------------------------------------------
252
254 BlisParams *BlisPar_;
255
257 CoinMessageHandler *blisMessageHandler_;
258
260 CoinMessages blisMessages_;
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
288 BcpsConstraintPool *constraintPoolSend_;
289
291 BcpsConstraintPool *constraintPoolReceive_;
292
293 public:
294
296 bool isRoot_;
297
299 int boundingPass_;
300
302 double integerTol_;
303
305 double optimalRelGap_;
306
308 double optimalAbsGap_;
309
311 double currRelGap_;
312
314 double currAbsGap_;
315
317 BlisHeurStrategy heurStrategy_;
318
320 int heurCallFrequency_;
321
323 OsiCuts newCutPool_;
324
326 std::vector<AlpsTreeNode *> leafToRootPath;
327
328 protected:
329
331 void init();
332
334 void createObjects();
335
336 public:
337
339 BlisModel()
340 {
341 init();
342 }
343
345 virtual ~BlisModel();
346
348 void gutsOfDestructor();
349
350 //------------------------------------------------------
351 // SETUP, LP SOLVER
352 //------------------------------------------------------
353
355 void setColMatrix(CoinPackedMatrix *mat){ colMatrix_ = mat; }
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
443 virtual OsiSolverInterface *getSolver() { return origLpSolver_; }
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
464 int getNumBranchResolve() { return numBranchResolve_; }
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
534 int storeSolution(BlisSolutionType how, BlisSolution* sol);
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;
549 lpSolver_->setDblParam(OsiDualObjectiveLimit, 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
587 inline BcpsBranchStrategy * branchStrategy() const
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 }
601 inline BcpsBranchStrategy * rampUpBranchStrategy() const
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
624 void clearSharedObjectMark() {
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,
687 BlisCutStrategy strategy = BlisCutStrategyAuto,
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
706 BcpsConstraintPool *constraintPool() { return constraintPool_; }
707
709 BcpsConstraintPool *constraintPoolReceive()
710 { return constraintPoolReceive_; }
711
713 BcpsConstraintPool *constraintPoolSend() { return constraintPoolSend_; }
714
716
717 int getNumOldConstraints() const { return numOldConstraints_; }
718
720 void setNumOldConstraints(int num) { numOldConstraints_ = num; }
721
723 int getOldConstraintsSize() const { return oldConstraintsSize_; }
724
726 void setOldConstraintsSize(int num) { oldConstraintsSize_ = num; }
727
729 BlisConstraint **oldConstraints() { return oldConstraints_; }
730
732 void setOldConstraints(BlisConstraint **old) { oldConstraints_ = old; }
733
735 void delOldConstraints() {
736 delete [] oldConstraints_;
737 oldConstraints_ = NULL;
738 }
740
742 BlisCutStrategy getCutStrategy() const {
743 return cutStrategy_;
744 }
745
747 void setCutStrategy(BlisCutStrategy u) { cutStrategy_ = u; }
748
750 int getCutGenerationFrequency() const { return cutGenerationFrequency_; }
751
753 void setCutStrategy(int f) { cutGenerationFrequency_ = f; }
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;
822 aveIterations_ = numIterations_ / numNodes_;
823 }
824
826 CoinMessageHandler * blisMessageHandler() const
827 { return blisMessageHandler_; }
828
830 CoinMessages blisMessages() { return blisMessages_; }
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
853 AlpsReturnStatus decodeBlis(AlpsEncoded &encoded);
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 */
BlisModel::startVarLB
double * startVarLB()
The starting variable bounds arrary of a subproblem (internal use).
Definition: BlisModel.h:497
BlisModel::numHeuristics
int numHeuristics() const
Get the number of heuristics.
Definition: BlisModel.h:675
BlisModel::fathomAllNodes
virtual bool fathomAllNodes()
Return true, if all nodes can be fathomed.
BlisHotStartStrategy
BlisHotStartStrategy
Definition: Blis.h:95
BlisModel::createIntgerObjects
void createIntgerObjects(bool startAgain)
Identify integer variable.
BlisHeurStrategy
BlisHeurStrategy
Definition: Blis.h:77
BlisModel
Definition: BlisModel.h:60
BlisModel::presolvedLpSolver_
OsiSolverInterface * presolvedLpSolver_
Presolved.
Definition: BlisModel.h:80
BlisModel::rampUpBranchStrategy_
BcpsBranchStrategy * rampUpBranchStrategy_
Definition: BlisModel.h:171
BlisModel::setSharedObjectMark
void setSharedObjectMark(int i)
Mark object to be shared.
Definition: BlisModel.h:621
BlisModel::cutoffInc_
double cutoffInc_
Cutoff increment.
Definition: BlisModel.h:127
BlisModel::optimalAbsGap_
double optimalAbsGap_
Absolute optimal gap.
Definition: BlisModel.h:260
CoinPackedMatrix.hpp
BlisModel::heurCallFrequency_
int heurCallFrequency_
Frequency of using heuristics.
Definition: BlisModel.h:320
BlisModel::intObjIndices_
int * intObjIndices_
Definition: BlisModel.h:158
BlisModel::getNumStrong
int getNumStrong()
Get number of strong branchings.
Definition: BlisModel.h:458
BlisModel::startConUB_
double * startConUB_
Starting var/con bounds for processing each node.
Definition: BlisModel.h:138
BlisPresolve
A interface to Osi/Coin Presolve.
Definition: BlisPresolve.h:37
BlisModel::delOldConstraints
void delOldConstraints()
Set max number of old constraints.
Definition: BlisModel.h:735
BlisModel::nodeWeight_
double nodeWeight_
Definition: BlisModel.h:165
BlisConGenerator.h
BlisModel::packSharedKnowlege
virtual AlpsEncoded * packSharedKnowlege()
Pack knowledge to be shared with others into an encoded object.
BlisModel::numOldConstraints_
int numOldConstraints_
Number of old constraints.
Definition: BlisModel.h:203
BlisModel::cutGenerators
BlisConGenerator * cutGenerators(int i) const
Get a specific cut generator.
Definition: BlisModel.h:694
BlisModel::numStrong_
int numStrong_
Number of strong branching.
Definition: BlisModel.h:162
BlisModel::blisMessageHandler
CoinMessageHandler * blisMessageHandler() const
Get the message handler.
Definition: BlisModel.h:826
BlisModel::hotstartStrategy_
BlisHotStartStrategy hotstartStrategy_
Definition: BlisModel.h:176
CoinMessageHandler
Base class for message handling.
Definition: CoinMessageHandler.hpp:327
BlisModel::presolve_
BlisPresolve * presolve_
Definition: BlisModel.h:129
BlisModel::BlisPar
BlisParams * BlisPar()
Access parameters.
Definition: BlisModel.h:834
BlisModel::numObjects
int numObjects() const
Get the number of objects.
Definition: BlisModel.h:609
CoinLpIO.hpp
BlisModel::numObjects_
int numObjects_
Number of objects.
Definition: BlisModel.h:150
BlisModel::analyzeObjective
void analyzeObjective()
BlisModel::heuristics
BlisHeuristic * heuristics(int i) const
Get a specific heuristic.
Definition: BlisModel.h:672
BlisModel::objects_
BcpsObject ** objects_
The set of objects.
Definition: BlisModel.h:153
BlisModel::startConLB_
double * startConLB_
Starting var/con bounds for processing each node.
Definition: BlisModel.h:137
BlisModel::denseConCutoff_
int denseConCutoff_
Dense constraint cutoff.
Definition: BlisModel.h:209
BlisModel::nodeLog
virtual void nodeLog(AlpsTreeNode *node, bool force)
Node log.
BlisModel::getNumHeurSolutions
int getNumHeurSolutions() const
Get number of heuristic solutions.
Definition: BlisModel.h:528
BlisModel::feasibleSolution
bool feasibleSolution(int &numIntegerInfs)
Test the current lp solution for feasiblility.
BlisModel::getNodeWeight
double getNodeWeight() const
Definition: BlisModel.h:795
BlisModel::constraintPool
BcpsConstraintPool * constraintPool()
Access constraint pool.
Definition: BlisModel.h:706
BlisModel::numIntObjects_
int numIntObjects_
Column types.
Definition: BlisModel.h:115
BlisModel::leafToRootPath
std::vector< AlpsTreeNode * > leafToRootPath
Record the path from leaf to root.
Definition: BlisModel.h:271
AlpsReturnStatus
AlpsReturnStatus
Definition: Alps.h:118
BlisModel::getColUpper
const double * getColUpper()
Get column upper bound.
Definition: BlisModel.h:480
BlisHeuristic
Heuristic base class.
Definition: BlisHeuristic.h:46
BlisModel::getNumOldConstraints
int getNumOldConstraints() const
Get number of old constraints.
Definition: BlisModel.h:717
BlisModel::getAveIterations
int getAveIterations() const
Get the average iterations it took to solve a lp.
Definition: BlisModel.h:814
BlisModel::readInstance
virtual void readInstance(const char *dataFile)
Read in the instance data.
BlisModel::numSolutions_
int numSolutions_
Definition: BlisModel.h:111
BlisModel::numCutGenerators
int numCutGenerators() const
Get the number of cut generators.
Definition: BlisModel.h:697
BlisModel::getMaxNumCons
int getMaxNumCons() const
Get the max number of cuts can be generated.
Definition: BlisModel.h:700
BcpsVariable
Definition: BcpsObject.h:383
OsiSolverInterface::getColUpper
virtual const double * getColUpper() const =0
Get a pointer to an array[getNumCols()] of column upper bounds.
OsiSolverInterface::getNumCols
virtual int getNumCols() const =0
Get the number of columns.
BlisModel::setSolEstimate
void setSolEstimate(double est)
Set the solution estimate of the active node.
Definition: BlisModel.h:455
BlisModel::getIntColIndices
int * getIntColIndices() const
Get integers&#39; column indices.
Definition: BlisModel.h:648
BlisModel::encode
virtual AlpsEncoded * encode() const
The method that encodes the model into a encoded object.
BcpsObject
A class for describing the objects that comprise a BCPS subproblem.
Definition: BcpsObject.h:76
BlisModel::importModel
virtual void importModel(std::vector< BlisVariable * > vars, std::vector< BlisConstraint * > cons)
For parallel code, only the master calls this function.
BlisModel::lpSolver_
OsiSolverInterface * lpSolver_
Lp solver.
Definition: BlisModel.h:69
BcpsBranchStrategy.h
BlisMessage.h
BlisModel::heurStrategy_
BlisHeurStrategy heurStrategy_
If use heuristics.
Definition: BlisModel.h:317
BlisModel::setBranchingMethod
void setBranchingMethod(BcpsBranchStrategy &method)
Set the branching stratedy.
Definition: BlisModel.h:597
AlpsParams.h
BlisModel::maxNumCons_
int maxNumCons_
Number of cuts can be generators.
Definition: BlisModel.h:188
AlpsEnumProcessT.h
CoinPackedMatrix
Sparse Matrix Base Class.
Definition: CoinPackedMatrix.hpp:79
BlisModel::~BlisModel
virtual ~BlisModel()
Destructor.
BlisModel::constraintPoolSend
BcpsConstraintPool * constraintPoolSend()
Access send constraint pool.
Definition: BlisModel.h:713
BlisModel::getDenseConCutoff
int getDenseConCutoff() const
Get the thresheld to be considered as a dense constraint.
Definition: BlisModel.h:756
BlisModel::getLpObjValue
double getLpObjValue() const
Get current objective function value.
Definition: BlisModel.h:515
BlisModel::init
void init()
Intialize member data.
BlisModel::constraintPoolReceive
BcpsConstraintPool * constraintPoolReceive()
Access receive constraint pool.
Definition: BlisModel.h:709
BlisModel::inputVar_
std::vector< BcpsVariable * > inputVar_
User&#39;s input objects.
Definition: BlisModel.h:121
BlisModel::getObjCoef
double * getObjCoef() const
Get objective coefficients.
Definition: BlisModel.h:474
BlisModel::storeSolution
int storeSolution(BlisSolutionType how, BlisSolution *sol)
Record a new incumbent solution and update objectiveValue.
BlisModel::numCutGenerators_
int numCutGenerators_
Number of cut generators used.
Definition: BlisModel.h:185
BlisModel::activeNode_
AlpsTreeNode * activeNode_
Active node.
Definition: BlisModel.h:159
OsiCuts
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
BlisModel::startConUB
double * startConUB()
Definition: BlisModel.h:502
BlisModel::addObjects
void addObjects(int numObjects, BcpsObject **objects)
Add in object information.
AlpsEncoded
This data structure is to contain the packed form of an encodable knowledge.
Definition: AlpsEncoded.h:25
BlisModel::checkInteger
bool checkInteger(double value) const
Check if a value is integer.
Definition: BlisModel.h:651
BlisModel::startVarUB_
double * startVarUB_
Starting var/con bounds for processing each node.
Definition: BlisModel.h:136
BlisModel::setBranchingMethod
void setBranchingMethod(BcpsBranchStrategy *method)
Set the branching strategy.
Definition: BlisModel.h:591
BlisModel::getNumNodes
int getNumNodes() const
Get how many Nodes it took to solve the problem.
Definition: BlisModel.h:808
BcpsObjectPool.h
BlisModel::tempVarLBPos
int * tempVarLBPos()
Temparory storage.
Definition: BlisModel.h:505
BlisModel::startVarLB_
double * startVarLB_
Starting var/con bounds for processing each node.
Definition: BlisModel.h:135
BlisModel::tempConLBPos
int * tempConLBPos()
Definition: BlisModel.h:507
BcpsModel.h
BlisModel::currAbsGap_
double currAbsGap_
Current absolute optimal gap.
Definition: BlisModel.h:314
BlisModel::getNumBranchResolve
int getNumBranchResolve()
Get the maximum number of resolve during branching.
Definition: BlisModel.h:464
AlpsTreeNode::setSolEstimate
void setSolEstimate(double est)
Query/set the solution estimate of the node.
Definition: AlpsTreeNode.h:217
BlisModel::optimalRelGap_
double optimalRelGap_
Relative optimal gap.
Definition: BlisModel.h:257
BlisModel::addCutGenerator
void addCutGenerator(CglCutGenerator *generator, const char *name=NULL, int strategy=0, bool normal=true, bool atSolution=false, bool whenInfeasible=false)
Add a cut generator.
BlisModel::setNumOldConstraints
void setNumOldConstraints(int num)
Set number of old constraints.
Definition: BlisModel.h:720
BlisModel::colType_
char * colType_
Column types.
Definition: BlisModel.h:104
BlisModel::setNumVars
void setNumVars(int num)
Pass column upper bounds.
Definition: BlisModel.h:361
BlisModel::varLB
double * varLB()
Get variable bounds arrary.
Definition: BlisModel.h:489
BlisModel::setNumBranchResolve
void setNumBranchResolve(int num)
Set the maximum number of resolve during branching.
Definition: BlisModel.h:467
BlisModel::cutStrategy_
BlisCutStrategy cutStrategy_
If use cut generators.
Definition: BlisModel.h:217
OsiSolverInterface::getObjValue
virtual double getObjValue() const =0
Get the objective function value.
BlisModel::setConUb
void setConUb(double *cu)
Pass column lower bounds.
Definition: BlisModel.h:370
BlisModel::numHeuristics_
int numHeuristics_
Number of heuristics.
Definition: BlisModel.h:172
BlisModel::conRandoms_
double * conRandoms_
Random keys.
Definition: BlisModel.h:206
BlisModel::colMatrix_
CoinPackedMatrix * colMatrix_
Orignial column majored matrix.
Definition: BlisModel.h:76
BlisConGenerator
Interface between Blis and Cut Generation Library.
Definition: BlisConGenerator.h:56
BcpsObject.h
BlisCutStrategy
BlisCutStrategy
Definition: Blis.h:69
BlisModel::setMaxNumCons
void setMaxNumCons(int m)
Set the max number of cuts can be generated.
Definition: BlisModel.h:703
AlpsTreeNode
This class holds one node of the search tree.
Definition: AlpsTreeNode.h:50
Blis.h
BlisModel::cutoff_
double cutoff_
Cutoff in lp solver.
Definition: BlisModel.h:124
BlisModel::unpackSharedPseudocost
void unpackSharedPseudocost(AlpsEncoded &encoded)
Unpack and store shared pseduocost.
BlisModel::numHeurSolutions_
int numHeurSolutions_
Definition: BlisModel.h:112
OsiSolverInterface::getNumRows
virtual int getNumRows() const =0
Get the number of rows.
CglCutGenerator.hpp
BlisModel::inputCon_
std::vector< BcpsConstraint * > inputCon_
User&#39;s input objects.
Definition: BlisModel.h:122
BlisModel::objects
BcpsObject * objects(int which)
Get the specified object.
Definition: BlisModel.h:618
BlisParams::cutoffInc
The value added to relaxation value when deciding fathom.
Definition: BlisParams.h:103
BlisModel::unpackSharedVariables
void unpackSharedVariables(AlpsEncoded &encoded)
Unpack and store shared variables.
BlisModel::tempConUBPos
int * tempConUBPos()
Definition: BlisModel.h:508
BlisHeuristic.h
BlisModel::setNodeWeight
void setNodeWeight(double nw)
Definition: BlisModel.h:797
BlisModel::solver
virtual OsiSolverInterface * solver()
Get lp solver.
Definition: BlisModel.h:446
OsiSolverInterface::getColLower
virtual const double * getColLower() const =0
Get a pointer to an array[getNumCols()] of column lower bounds.
BlisModel::tempConLBPos_
int * tempConLBPos_
Tempory storage for var/con indices.
Definition: BlisModel.h:238
BlisModel::rampUpBranchStrategy
BcpsBranchStrategy * rampUpBranchStrategy() const
Get the current branching strategy.
Definition: BlisModel.h:601
BlisModel::setupSelf
virtual bool setupSelf()
Do necessary work to make model usable.
OsiSolverInterface::getColSolution
virtual const double * getColSolution() const =0
Get a pointer to an array[getNumCols()] of primal variable values.
BlisModel::priority
int priority(int sequence) const
Returns priority level for an object (or 1000 if no priorities exist)
Definition: BlisModel.h:790
BlisModel::feasibleSolutionHeur
BlisSolution * feasibleSolutionHeur(const double *solution)
Test if a solution found by heuristic is feasible.
BlisModel::currRelGap_
double currRelGap_
Current relative optimal gap.
Definition: BlisModel.h:311
BlisModel::getCutoff
double getCutoff() const
Get cut off value.
Definition: BlisModel.h:537
BlisModel::setNumElems
void setNumElems(int num)
Pass column upper bounds.
Definition: BlisModel.h:364
BlisModel::BlisModel
BlisModel()
Default construtor.
Definition: BlisModel.h:339
BlisModel::conLB_
double * conLB_
Variable and constraint bounds.
Definition: BlisModel.h:96
BlisModel::varLB_
double * varLB_
Variable and constraint bounds.
Definition: BlisModel.h:94
BcpsModel
Definition: BcpsModel.h:40
BlisModel::cutGenerationFrequency_
int cutGenerationFrequency_
Frequency of cut generation.
Definition: BlisModel.h:220
BlisModel::getNumSolutions
int getNumSolutions() const
Get number of solutions.
Definition: BlisModel.h:525
BlisModel::presolved
bool presolved
Definition: BlisModel.h:131
BlisModel::packSharedPseudocost
void packSharedPseudocost(AlpsEncoded *encoded, int numToShare)
Retrieve and pack shared pseudocost.
BcpsConstraintPool
Definition: BcpsObjectPool.h:104
BlisModel::branchStrategy
BcpsBranchStrategy * branchStrategy() const
Get the current branching strategy.
Definition: BlisModel.h:587
BlisModel::numIterations_
int numIterations_
Number of lp(Simplex) iterations.
Definition: BlisModel.h:225
BlisModel::objSense_
double objSense_
Objective function.
Definition: BlisModel.h:96
BlisModel::oldConstraintsSize_
int oldConstraintsSize_
The memory size allocated for oldConstraints_.
Definition: BlisModel.h:200
BlisSolution
This class contains the solutions generated by the LP solver (either primal or dual.
Definition: BlisSolution.h:36
BlisModel::clearSharedObjectMark
void clearSharedObjectMark()
Clear all the share mark.
Definition: BlisModel.h:624
BlisModel::blisMessages
CoinMessages blisMessages()
Return messages.
Definition: BlisModel.h:830
OsiSolverInterface.hpp
OsiSolverInterface
Abstract Base Class for describing an interface to a solver.
Definition: OsiSolverInterface.hpp:62
BlisModel::objCoef_
double * objCoef_
Objective function.
Definition: BlisModel.h:97
BlisModel::numElems_
int numElems_
Number of columns/rows/elements in active subproblem.
Definition: BlisModel.h:91
BlisModel::presolveForTheWholeTree
virtual void presolveForTheWholeTree()
BlisModel::tempVarUBPos_
int * tempVarUBPos_
Tempory storage for var/con indices.
Definition: BlisModel.h:237
BcpsBranchStrategy
Branching strategy specifies: (1) how to select a candidate set of branching objects (2) how to compa...
Definition: BcpsBranchStrategy.h:39
BlisModel::varUB_
double * varUB_
Variable and constraint bounds.
Definition: BlisModel.h:95
BlisModel::setDenseConCutoff
void setDenseConCutoff(int cutoff)
Set the thresheld to be considered as a dense constraint.
Definition: BlisModel.h:759
BlisModel::incObjValue_
double incObjValue_
Saved lp solution for temporatory usage.
Definition: BlisModel.h:118
BlisModel::conUB
double * conUB()
Definition: BlisModel.h:494
CglCutGenerator
Cut Generator Base Class.
Definition: CglCutGenerator.hpp:23
BlisModel::incumbent_
double * incumbent_
Incumbent.
Definition: BlisModel.h:121
BlisModel::startConLB
double * startConLB()
The starting constraint bounds arrary of a subproblem (internal use).
Definition: BlisModel.h:501
BlisModel::packSharedVariables
void packSharedVariables(AlpsEncoded *encoded)
Retrieve and pack shared variables.
BlisModel::unpackSharedConstraints
void unpackSharedConstraints(AlpsEncoded &encoded)
Unpack and store shared constraints.
BlisModel::getNumIntObjects
int getNumIntObjects() const
Get number of integers.
Definition: BlisModel.h:645
BlisModel::getCutStrategy
BlisCutStrategy getCutStrategy() const
Query constraint generation strategy.
Definition: BlisModel.h:742
BlisModel::modelLog
virtual void modelLog()
Log of specific models.
BlisModel::gutsOfDestructor
void gutsOfDestructor()
Actual destructor.
BlisModel::setSolver
virtual void setSolver(OsiSolverInterface *si)
Set lp solver.
Definition: BlisModel.h:440
BlisModel::tempVarLBPos_
int * tempVarLBPos_
Tempory storage for var/con indices.
Definition: BlisModel.h:236
BlisPseudo.h
BlisModel::generators_
BlisConGenerator ** generators_
The list of cut generators used.
Definition: BlisModel.h:191
BlisModel::setCutoff
void setCutoff(double co)
Set cut off value.
Definition: BlisModel.h:540
BlisModel::createRoot
virtual AlpsTreeNode * createRoot()
Create the root node based on model.
BlisModel::sharedObjectMark_
char * sharedObjectMark_
The objects that can be shared.
Definition: BlisModel.h:185
BlisModel::postprocess
virtual void postprocess()
Postprocessing the searching results.
BlisModel::newCutPool_
OsiCuts newCutPool_
Store new cuts in each pass.
Definition: BlisModel.h:266
BlisModel::branchStrategy_
BcpsBranchStrategy * branchStrategy_
Variable selection function.
Definition: BlisModel.h:142
BlisModel::createObjects
void createObjects()
Create variables and constraints.
BlisCutStrategyAuto
Definition: Blis.h:73
BlisModel::setOldConstraintsSize
void setOldConstraintsSize(int num)
Set max number of old constraints.
Definition: BlisModel.h:726
BlisModel::constraintPoolReceive_
BcpsConstraintPool * constraintPoolReceive_
Constraints that are received from other processses.
Definition: BlisModel.h:291
CoinMessages
Class to hold and manipulate an array of massaged messages.
Definition: CoinMessageHandler.hpp:128
BlisModel::getNumRows
int getNumRows()
Get number of rows.
Definition: BlisModel.h:486
BlisModel::numCols_
int numCols_
Number of columns/rows/elements in active subproblem.
Definition: BlisModel.h:89
BlisModel::numNodes_
int numNodes_
Number of processed nodes.
Definition: BlisModel.h:222
AlpsTreeNode.h
BlisModel::intColIndices_
int * intColIndices_
Column types.
Definition: BlisModel.h:116
BlisModel::getConRandoms
double * getConRandoms() const
Get randoms for check parallel constraints.
Definition: BlisModel.h:762
BlisParams.h
BlisModel::incumbent
double * incumbent()
Return best ip solution found so far.
Definition: BlisModel.h:531
BlisModel::setVarUb
void setVarUb(double *ub)
Pass variable lower bounds.
Definition: BlisModel.h:376
BlisModel::oldConstraints
BlisConstraint ** oldConstraints()
Access old constraints.
Definition: BlisModel.h:729
BlisModel::objects
BcpsObject ** objects()
Get the array of objects.
Definition: BlisModel.h:615
BlisModel::aveIterations_
int aveIterations_
Average number of lp iterations to solve a subproblem.
Definition: BlisModel.h:228
BlisModel::getCutGenerationFrequency
int getCutGenerationFrequency() const
Query constraint generation frequency.
Definition: BlisModel.h:750
BlisModel::getIntObjIndices
int * getIntObjIndices() const
Get integers&#39; object indices.
Definition: BlisModel.h:642
BlisModel::tempVarUBPos
int * tempVarUBPos()
Definition: BlisModel.h:506
BlisModel::getOldConstraintsSize
int getOldConstraintsSize() const
Get max number of old constraints.
Definition: BlisModel.h:723
BlisModel::boundingPass_
int boundingPass_
The number of passes during bounding procedure.
Definition: BlisModel.h:299
BlisModel::setNumCons
void setNumCons(int num)
Pass column upper bounds.
Definition: BlisModel.h:358
BlisModel::setConLb
void setConLb(double *cl)
Pass column upper bounds.
Definition: BlisModel.h:367
BlisParams
Definition: BlisParams.h:35
BlisModel::setVarLb
void setVarLb(double *lb)
Pass variable upper bounds.
Definition: BlisModel.h:373
BlisModel::preprocess
virtual void preprocess()
Preprocessing the model.
BlisModel::decodeBlis
AlpsReturnStatus decodeBlis(AlpsEncoded &encoded)
Unpack Blis portion of the model from an encoded object.
BlisModel::constraintPoolSend_
BcpsConstraintPool * constraintPoolSend_
Constraints that can be sent/broadcasted to other processes.
Definition: BlisModel.h:288
BlisModel::priority_
int * priority_
Priorities of integer object.
Definition: BlisModel.h:156
BlisModel::setOldConstraints
void setOldConstraints(BlisConstraint **old)
set old constraints.
Definition: BlisModel.h:732
BlisConstraint
Definition: BlisConstraint.h:31
BlisModel::packSharedConstraints
void packSharedConstraints(AlpsEncoded *encoded)
Retrieve and pack shared constraints.
BlisModel::passInPriorities
void passInPriorities(const int *priorities, bool ifNotSimpleIntegers, int defaultValue=1000)
Pass in branching priorities.
BlisModel::heuristics_
BlisHeuristic ** heuristics_
The list of heuristics.
Definition: BlisModel.h:175
BlisModel::getSolver
virtual OsiSolverInterface * getSolver()
Get lp solver.
Definition: BlisModel.h:443
BlisModel::setObjCoef
void setObjCoef(double *obj)
Pass objective coefficients.
Definition: BlisModel.h:384
BlisModel::isRoot_
bool isRoot_
If root node.
Definition: BlisModel.h:245
BlisModel::addNumNodes
void addNumNodes(int newNodes=1)
Increment node count.
Definition: BlisModel.h:817
CoinMpsIO.hpp
BlisModel::setCutStrategy
void setCutStrategy(int f)
Set constraint generation frequency.
Definition: BlisModel.h:753
BlisModel::conLB
double * conLB()
Get original constraint bounds arrary.
Definition: BlisModel.h:493
BlisParams::entry
bool entry(const boolParams key) const
Definition: BlisParams.h:192
BlisModel::BlisPar_
BlisParams * BlisPar_
Blis parameters.
Definition: BlisModel.h:216
BlisModel::addNumIterations
void addNumIterations(int newIter)
Increment Iteration count.
Definition: BlisModel.h:820
BlisModel::encodeBlis
AlpsReturnStatus encodeBlis(AlpsEncoded *encoded) const
Pack Blis portion of the model into an encoded object.
BlisModel::decodeToSelf
virtual void decodeToSelf(AlpsEncoded &)
The method that decodes the model from a encoded object.
BlisModel::setColMatrix
void setColMatrix(CoinPackedMatrix *mat)
Pass a matrix in.
Definition: BlisModel.h:355
BlisModel::blisMessageHandler_
CoinMessageHandler * blisMessageHandler_
Message handler.
Definition: BlisModel.h:257
BlisModel::addNumStrong
void addNumStrong(int num=1)
Add num to number of strong branchings.
Definition: BlisModel.h:461
BlisModel::deleteObjects
void deleteObjects()
Delete all object information.
BlisModel::resolve
bool resolve()
Resolving a lp.
BlisModel::setCutStrategy
void setCutStrategy(BlisCutStrategy u)
Set constraint generation strategy.
Definition: BlisModel.h:747
BlisModel::addHeuristic
void addHeuristic(BlisHeuristic *heur)
Add a heuristic.
BlisPresolve.h
BlisModel::unpackSharedKnowledge
virtual void unpackSharedKnowledge(AlpsEncoded &)
Unpack and store shared knowledge from an encoded object.
BlisModel::origLpSolver_
OsiSolverInterface * origLpSolver_
Input by user.
Definition: BlisModel.h:78
BlisModel::getNumCols
int getNumCols()
Get number of columns.
Definition: BlisModel.h:483
BlisModel::oldConstraints_
BlisConstraint ** oldConstraints_
Temporary store old cuts at a node when installing a node.
Definition: BlisModel.h:197
BlisModel::constraintPool_
BcpsConstraintPool * constraintPool_
Store all the cuts.
Definition: BlisModel.h:194
OsiCuts.hpp
BlisModel::writeParameters
virtual void writeParameters(std::ostream &outstream) const
Write out parameters.
BlisSolutionType
BlisSolutionType
Definition: Blis.h:112
BlisModel::blisMessages_
CoinMessages blisMessages_
Blis messages.
Definition: BlisModel.h:260
BlisModel::getColLower
const double * getColLower()
Get column lower bound.
Definition: BlisModel.h:477
BlisModel::getLpSolution
const double * getLpSolution() const
Get active lp solution.
Definition: BlisModel.h:518
BlisModel::numBranchResolve_
int numBranchResolve_
Maximum number of resolve during branching.
Definition: BlisModel.h:200
BlisModel::priority
const int * priority() const
Priorities.
Definition: BlisModel.h:787
BlisModel::registerKnowledge
virtual void registerKnowledge()
Register knowledge.
OsiSolverInterface::setDblParam
virtual bool setDblParam(OsiDblParam key, double value)
Set a double parameter.
Definition: OsiSolverInterface.hpp:272
AlpsKnowledge::encode
virtual AlpsEncoded * encode() const
This method should encode the content of the object and return a pointer to the encoded form...
BlisModel::startVarUB
double * startVarUB()
Definition: BlisModel.h:498
BlisModel::setColType
void setColType(char *colType)
Pass variable types.
Definition: BlisModel.h:379
BlisModel::conUB_
double * conUB_
Variable and constraint bounds.
Definition: BlisModel.h:97
OsiDualObjectiveLimit
Dual objective limit.
Definition: OsiSolverParameters.hpp:58
BlisModel::tempConUBPos_
int * tempConUBPos_
Tempory storage for var/con indices.
Definition: BlisModel.h:239
BlisModel::getNumIterations
int getNumIterations() const
Get how many iterations it took to solve the problem.
Definition: BlisModel.h:811
BlisModel::readParameters
virtual void readParameters(const int argnum, const char *const *arglist)
Read in Alps, Blis parameters.
BlisVariable
Definition: BlisVariable.h:31
BlisModel::numRows_
int numRows_
Number of columns/rows/elements in active subproblem.
Definition: BlisModel.h:90
BlisModel::varUB
double * varUB()
Definition: BlisModel.h:490
BlisModel::problemSetup
bool problemSetup
Definition: BlisModel.h:132
BlisModel::integerTol_
double integerTol_
Integer tolerance.
Definition: BlisModel.h:254
BlisModel::setActiveNode
void setActiveNode(AlpsTreeNode *node)
Set active node.
Definition: BlisModel.h:452
BlisModel::userFeasibleSolution
virtual BlisSolution * userFeasibleSolution(const double *solution, bool &feasible)
User&#39;s criteria for a feasible solution.
Definition: BlisModel.h:571
BlisModel::setNumObjects
void setNumObjects(int num)
Set the number of objects.
Definition: BlisModel.h:612