pricingjob.c
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 
36 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
37 
38 #include "pricingjob.h"
39 #include "pub_gcgcol.h"
40 #include "pub_pricingjob.h"
41 
42 #include "gcg.h"
43 #include "pub_pricingprob.h"
44 
45 #include "scip/scip.h"
46 
47 
49 SCIP_RETCODE GCGpricingjobCreate(
50  SCIP* scip,
51  GCG_PRICINGJOB** pricingjob,
52  GCG_PRICINGPROB* pricingprob,
53  GCG_SOLVER* solver,
54  int chunk
55 )
56 {
57  SCIP_CALL( SCIPallocMemory(scip, pricingjob) );
58 
59  (*pricingjob)->pricingprob = pricingprob;
60  (*pricingjob)->solver = solver;
61  (*pricingjob)->chunk = chunk;
62  (*pricingjob)->score = 0.0;
63  (*pricingjob)->heuristic = FALSE;
64  (*pricingjob)->nheuriters = 0;
65 
66  return SCIP_OKAY;
67 }
68 
71  SCIP* scip,
72  GCG_PRICINGJOB** pricingjob
73 )
74 {
75  SCIPfreeMemory(scip, pricingjob);
76  *pricingjob = NULL;
77 }
78 
80 SCIP_RETCODE GCGpricingjobSetup(
81  GCG_PRICINGJOB* pricingjob,
82  SCIP_Bool heuristic,
83  int scoring,
84  int nroundscol,
85  SCIP_Real dualsolconv,
86  int npointsprob,
87  int nraysprob
88  )
89 {
90  GCG_PRICINGPROB* pricingprob = GCGpricingjobGetPricingprob(pricingjob);
91 
92  pricingjob->heuristic = heuristic;
93 
94  /* set the score; the larger, the better */
95  switch( scoring )
96  {
97  case 'i':
98  pricingjob->score = - (SCIP_Real) GCGpricingprobGetProbnr(pricingprob);
99  break;
100  case 'd':
101  pricingjob->score = dualsolconv;
102  break;
103  case 'r':
104  pricingjob->score = -(0.2 * npointsprob + nraysprob);
105  break;
106  case 'l':
107  pricingjob->score = (SCIP_Real) GCGpricingprobGetNColsLastRounds(pricingprob, nroundscol);
108  break;
109  default:
110  pricingjob->score = 0.0;
111  break;
112  }
113 
114  /* initialize result variables */
115  pricingjob->nheuriters = 0;
116 
117  return SCIP_OKAY;
118 }
119 
122  GCG_PRICINGJOB* pricingjob
123  )
124 {
125  return pricingjob->pricingprob;
126 }
129  GCG_PRICINGJOB* pricingjob
130  )
131 {
132  return pricingjob->solver;
133 }
134 
137  GCG_PRICINGJOB* pricingjob
138  )
139 {
140  return pricingjob->chunk;
141 }
142 
145  GCG_PRICINGJOB* pricingjob
146  )
147 {
148  return pricingjob->score;
149 }
150 
153  GCG_PRICINGJOB* pricingjob
154  )
155 {
156  return pricingjob->heuristic;
157 }
158 
161  GCG_PRICINGJOB* pricingjob
162  )
163 {
164  pricingjob->heuristic = FALSE;
165 }
166 
169  GCG_PRICINGJOB* pricingjob
170  )
171 {
172  pricingjob->heuristic = TRUE;
173  pricingjob->nheuriters = 0;
174 }
175 
178  GCG_PRICINGJOB* pricingjob
179  )
180 {
181  if( pricingjob->heuristic )
182  ++pricingjob->nheuriters;
183 }
184 
187  GCG_PRICINGJOB* pricingjob
188  )
189 {
190  return pricingjob->nheuriters;
191 }
struct GCG_PricingJob GCG_PRICINGJOB
SCIP_Real GCGpricingjobGetChunk(GCG_PRICINGJOB *pricingjob)
Definition: pricingjob.c:136
struct GCG_Solver GCG_SOLVER
Definition: type_solver.h:50
int GCGpricingprobGetProbnr(GCG_PRICINGPROB *pricingprob)
Definition: pricingprob.c:203
GCG interface methods.
int GCGpricingjobGetNHeurIters(GCG_PRICINGJOB *pricingjob)
Definition: pricingjob.c:186
SCIP_Real GCGpricingjobGetScore(GCG_PRICINGJOB *pricingjob)
Definition: pricingjob.c:144
SCIP_RETCODE GCGpricingjobSetup(GCG_PRICINGJOB *pricingjob, SCIP_Bool heuristic, int scoring, int nroundscol, SCIP_Real dualsolconv, int npointsprob, int nraysprob)
Definition: pricingjob.c:80
SCIP_Bool GCGpricingjobIsHeuristic(GCG_PRICINGJOB *pricingjob)
Definition: pricingjob.c:152
void GCGpricingjobFree(SCIP *scip, GCG_PRICINGJOB **pricingjob)
Definition: pricingjob.c:70
void GCGpricingjobIncreaseNHeurIters(GCG_PRICINGJOB *pricingjob)
Definition: pricingjob.c:177
private methods for working with pricing jobs, to be used by the pricing controller only ...
int GCGpricingprobGetNColsLastRounds(GCG_PRICINGPROB *pricingprob, int nroundscol)
Definition: pricingprob.c:302
public methods for working with gcg columns
void GCGpricingjobSetExact(GCG_PRICINGJOB *pricingjob)
Definition: pricingjob.c:160
SCIP_RETCODE GCGpricingjobCreate(SCIP *scip, GCG_PRICINGJOB **pricingjob, GCG_PRICINGPROB *pricingprob, GCG_SOLVER *solver, int chunk)
Definition: pricingjob.c:49
GCG_SOLVER * GCGpricingjobGetSolver(GCG_PRICINGJOB *pricingjob)
Definition: pricingjob.c:128
void GCGpricingjobResetHeuristic(GCG_PRICINGJOB *pricingjob)
Definition: pricingjob.c:168
public methods for working with pricing jobs
public methods for working with pricing problems
struct GCG_PricingProb GCG_PRICINGPROB
GCG_PRICINGPROB * GCGpricingjobGetPricingprob(GCG_PRICINGJOB *pricingjob)
Definition: pricingjob.c:121