class_pricingcontroller.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program */
4 /* GCG --- Generic Column Generation */
5 /* a Dantzig-Wolfe decomposition based extension */
6 /* of the branch-cut-and-price framework */
7 /* SCIP --- Solving Constraint Integer Programs */
8 /* */
9 /* Copyright (C) 2010-2018 Operations Research, RWTH Aachen University */
10 /* Zuse Institute Berlin (ZIB) */
11 /* */
12 /* This program is free software; you can redistribute it and/or */
13 /* modify it under the terms of the GNU Lesser General Public License */
14 /* as published by the Free Software Foundation; either version 3 */
15 /* of the License, or (at your option) any later version. */
16 /* */
17 /* This program is distributed in the hope that it will be useful, */
18 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
19 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
20 /* GNU Lesser General Public License for more details. */
21 /* */
22 /* You should have received a copy of the GNU Lesser General Public License */
23 /* along with this program; if not, write to the Free Software */
24 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.*/
25 /* */
26 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27 
33 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
34 
35 #ifndef CLASS_PRICINGCONTROLLER_H_
36 #define CLASS_PRICINGCONTROLLER_H_
37 
38 #include "colpool.h"
39 #include "pricestore_gcg.h"
40 #include "class_pricingtype.h"
41 #include "type_gcgpqueue.h"
42 #include "type_pricingjob.h"
43 #include "type_pricingprob.h"
44 #include "objscip/objscip.h"
45 
46 namespace gcg {
47 
49 {
50 
51 private:
52  SCIP* scip_;
53  GCG_PRICINGPROB** pricingprobs;
54  int npricingprobs;
55  GCG_PRICINGJOB** pricingjobs;
56  int npricingjobs;
58  /* parameters */
59  int heurpricingiters;
60  int maxheurdepth;
61  char sorting;
62  int nroundscol;
63  int chunksize;
64  int eagerfreq;
66  /* strategy */
67  GCG_PQUEUE* pqueue;
68  SCIP_Real* score;
69  int maxniters;
70  int nchunks;
71  int curchunk;
72  int startchunk;
73  PricingType* pricingtype_;
75  /* statistics */
76  int eagerage;
77  int nsolvedprobs;
80 public:
83 
85  Pricingcontroller(SCIP* scip);
86 
88  virtual ~Pricingcontroller();
89 
90  SCIP_RETCODE addParameters();
91 
92  SCIP_RETCODE initSol();
93 
94  SCIP_RETCODE exitSol();
95 
97  SCIP_RETCODE initPricing(
98  PricingType* pricingtype
99  );
100 
102  void exitPricing();
103 
105  SCIP_RETCODE setupPriorityQueue(
106  SCIP_Real* dualsolconv
107  );
108 
111 
115  SCIP_RETCODE pricingprobNextBranchcons(
116  GCG_PRICINGPROB* pricingprob
117  );
118 
120  SCIP_RETCODE setPricingjobTimelimit(
121  GCG_PRICINGJOB* pricingjob
122  );
123 
125  void updatePricingprob(
126  GCG_PRICINGPROB* pricingprob,
127  GCG_PRICINGSTATUS status,
128  SCIP_Real lowerbound,
129  int nimpcols
130  );
131 
134  GCG_PRICINGJOB* pricingjob
135  );
136 
138  void evaluatePricingjob(
139  GCG_PRICINGJOB* pricingjob,
140  GCG_PRICINGSTATUS status
141  );
142 
144  void collectResults(
145  GCG_COL** bestcols,
146  SCIP_Bool* infeasible,
147  SCIP_Bool* optimal,
148  SCIP_Real* bestobjvals,
149  SCIP_Real* beststabobj,
150  SCIP_Real* bestredcost,
151  SCIP_Bool* bestredcostvalid
152  );
153 
155  SCIP_Bool checkNextChunk();
156 
158  SCIP_Bool canPricingloopBeAborted(
159  PricingType* pricingtype,
160  int nfoundcols,
161  int nsuccessfulprobs
162  ) const;
163 
164  void resetEagerage();
165 
166  void increaseEagerage();
167 
170  int probnr
171  );
172 
174  int getMaxNIters() const;
175 
176 
177 private:
179  static
180  SCIP_DECL_SORTPTRCOMP(comparePricingjobs);
181 
183  SCIP_RETCODE getGenericBranchconss();
184 
186  SCIP_Bool pricingprobIsDone(
187  GCG_PRICINGPROB* pricingprob
188  ) const;
189 
191  SCIP_Bool pricingprobNeedsNextBranchingcons(
192  GCG_PRICINGPROB* pricingprob
193  ) const;
194 };
195 
196 } /* namespace gcg */
197 #endif /* CLASS_PRICINGCONTROLLER_H_ */
void evaluatePricingjob(GCG_PRICINGJOB *pricingjob, GCG_PRICINGSTATUS status)
struct GCG_PricingJob GCG_PRICINGJOB
SCIP_RETCODE setPricingjobTimelimit(GCG_PRICINGJOB *pricingjob)
void updatePricingjobSolvingStats(GCG_PRICINGJOB *pricingjob)
SCIP_Bool canPricingloopBeAborted(PricingType *pricingtype, int nfoundcols, int nsuccessfulprobs) const
abstraction for SCIP pricing types
internal methods for storing cols in a col pool
struct GCG_PQueue GCG_PQUEUE
void updatePricingprob(GCG_PRICINGPROB *pricingprob, GCG_PRICINGSTATUS status, SCIP_Real lowerbound, int nimpcols)
enum GCG_PricingStatus GCG_PRICINGSTATUS
struct GCG_Col GCG_COL
Definition: type_gcgcol.h:45
type definitions for priority queue
GCG_PRICINGJOB * getNextPricingjob()
SCIP_RETCODE initPricing(PricingType *pricingtype)
SCIP_RETCODE pricingprobNextBranchcons(GCG_PRICINGPROB *pricingprob)
void collectResults(GCG_COL **bestcols, SCIP_Bool *infeasible, SCIP_Bool *optimal, SCIP_Real *bestobjvals, SCIP_Real *beststabobj, SCIP_Real *bestredcost, SCIP_Bool *bestredcostvalid)
GCG_PRICINGPROB * getPricingprob(int probnr)
type definitions for pricing problem data structure
struct GCG_PricingProb GCG_PRICINGPROB
type definitions for pricing job data structure
SCIP_RETCODE setupPriorityQueue(SCIP_Real *dualsolconv)