Scippy

SCIP

Solving Constraint Integer Programs

probdata_binpacking.c
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
4/* SCIP --- Solving Constraint Integer Programs */
5/* */
6/* Copyright (c) 2002-2025 Zuse Institute Berlin (ZIB) */
7/* */
8/* Licensed under the Apache License, Version 2.0 (the "License"); */
9/* you may not use this file except in compliance with the License. */
10/* You may obtain a copy of the License at */
11/* */
12/* http://www.apache.org/licenses/LICENSE-2.0 */
13/* */
14/* Unless required by applicable law or agreed to in writing, software */
15/* distributed under the License is distributed on an "AS IS" BASIS, */
16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17/* See the License for the specific language governing permissions and */
18/* limitations under the License. */
19/* */
20/* You should have received a copy of the Apache-2.0 license */
21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22/* */
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25/**@file probdata_binpacking.c
26 * @brief Problem data for binpacking problem
27 * @author Timo Berthold
28 * @author Stefan Heinz
29 *
30 * This file handles the main problem data used in that project. For more details see \ref BINPACKING_PROBLEMDATA page.
31 *
32 * @page BINPACKING_PROBLEMDATA Main problem data
33 *
34 * The problem data is accessible in all plugins. The function SCIPgetProbData() returns the pointer to that
35 * structure. We use this data structure to store all the information of the binpacking problem. Since this structure is
36 * not visible in the other plugins, we implemented setter and getter functions to access this data. The problem data
37 * structure SCIP_ProbData is shown below.
38 *
39 * \code
40 * ** @brief Problem data which is accessible in all places
41 * *
42 * * This problem data is used to store the input of the binpacking instance, all variables which are created, and all
43 * * constraints.
44 * *
45 * struct SCIP_ProbData
46 * {
47 * SCIP_VAR** vars; **< all exiting variables in the problem *
48 * SCIP_CONS** conss; **< set partitioning constraints for each item exactly one *
49 * SCIP_Longint* weights; **< array of item weights *
50 * int* ids; **< array of item ids *
51 * int nvars; **< number of generated variables *
52 * int varssize; **< size of the variable array *
53 * int nitems; **< number of items *
54 * SCIP_Longint capacity; **< bin capacity *
55 * };
56 * \endcode
57 *
58 * The function SCIPprobdataCreate(), which is called in the \ref reader_bpa.c "reader plugin" after the input file was
59 * parsed, initializes the problem data structure and creates the problem in the SCIP environment. For this, it creates
60 * for each item of the binpacking problem one set covering constraint and creates an initial set of variables for the
61 * packings. Note that the set covering constraints have to have the <code>modifiable</code>-flag set to TRUE. This is
62 * necessary to tell the solver that these constraints are not completed yet. This means, during the search new
63 * variables/packings might be added. The solver needs this information because certain reductions are not allowed.
64 * See the body of the function SCIPprobdataCreate() for more details.
65 *
66 * A list of all interface methods can be found in probdata_binpacking.h.
67 */
68
69/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
70
71#include <string.h>
72
73#include "probdata_binpacking.h"
74#include "vardata_binpacking.h"
75#include "pricer_binpacking.h"
76
77#include "scip/cons_setppc.h"
78#include "scip/scip.h"
79
80/** @brief Problem data which is accessible in all places
81 *
82 * This problem data is used to store the input of the binpacking, all variables which are created, and all
83 * constrsaints.
84 */
85struct SCIP_ProbData
86{
87 SCIP_VAR** vars; /**< all exiting variables in the problem */
88 SCIP_CONS** conss; /**< set partitioning constraints for each item exactly one */
89 SCIP_Longint* weights; /**< array of item weights */
90 int* ids; /**< array of item ids */
91 int nvars; /**< number of generated variables */
92 int varssize; /**< size of the variable array */
93 int nitems; /**< number of items */
94 SCIP_Longint capacity; /**< bin capacity */
95};
96
97
98/**@name Event handler properties
99 *
100 * @{
101 */
102
103#define EVENTHDLR_NAME "addedvar"
104#define EVENTHDLR_DESC "event handler for catching added variables"
105
106/**@} */
107
108/**@name Callback methods of event handler
109 *
110 * @{
111 */
112
113/** execution method of event handler */
114static
115SCIP_DECL_EVENTEXEC(eventExecAddedVar)
116{ /*lint --e{715}*/
117 assert(eventhdlr != NULL);
118 assert(strcmp(SCIPeventhdlrGetName(eventhdlr), EVENTHDLR_NAME) == 0);
119 assert(event != NULL);
121
122 SCIPdebugMsg(scip, "exec method of event handler for added variable to probdata\n");
123
124 /* add new variable to probdata */
126
127 return SCIP_OKAY;
128}
129
130/**@} */
131
132
133/**@name Local methods
134 *
135 * @{
136 */
137
138/** creates problem data */
139static
141 SCIP* scip, /**< SCIP data structure */
142 SCIP_PROBDATA** probdata, /**< pointer to problem data */
143 SCIP_VAR** vars, /**< all exist variables */
144 SCIP_CONS** conss, /**< set partitioning constraints for each job exactly one */
145 SCIP_Longint* weights, /**< array containing the item weights */
146 int* ids, /**< array of item ids */
147 int nvars, /**< number of variables */
148 int nitems, /**< number of items */
149 SCIP_Longint capacity /**< bin capacity */
150 )
151{
152 assert(scip != NULL);
153 assert(probdata != NULL);
154
155 /* allocate memory */
156 SCIP_CALL( SCIPallocBlockMemory(scip, probdata) );
157
158 if( nvars > 0 )
159 {
160 /* copy variable array */
161 SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &(*probdata)->vars, vars, nvars) );
162 }
163 else
164 (*probdata)->vars = NULL;
165
166 /* duplicate arrays */
167 SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &(*probdata)->conss, conss, nitems) );
168 SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &(*probdata)->weights, weights, nitems) );
169 SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &(*probdata)->ids, ids, nitems) );
170
171 (*probdata)->nvars = nvars;
172 (*probdata)->varssize = nvars;
173 (*probdata)->nitems = nitems;
174 (*probdata)->capacity = capacity;
175
176 return SCIP_OKAY;
177}
178
179/** frees the memory of the given problem data */
180static
182 SCIP* scip, /**< SCIP data structure */
183 SCIP_PROBDATA** probdata /**< pointer to problem data */
184 )
185{
186 int i;
187
188 assert(scip != NULL);
189 assert(probdata != NULL);
190
191 /* release all variables */
192 for( i = 0; i < (*probdata)->nvars; ++i )
193 {
194 SCIP_CALL( SCIPreleaseVar(scip, &(*probdata)->vars[i]) );
195 }
196
197 /* release all constraints */
198 for( i = 0; i < (*probdata)->nitems; ++i )
199 {
200 SCIP_CALL( SCIPreleaseCons(scip, &(*probdata)->conss[i]) );
201 }
202
203 /* free memory of arrays */
204 SCIPfreeBlockMemoryArray(scip, &(*probdata)->vars, (*probdata)->varssize);
205 SCIPfreeBlockMemoryArray(scip, &(*probdata)->conss, (*probdata)->nitems);
206 SCIPfreeBlockMemoryArray(scip, &(*probdata)->weights, (*probdata)->nitems);
207 SCIPfreeBlockMemoryArray(scip, &(*probdata)->ids, (*probdata)->nitems);
208
209 /* free probdata */
210 SCIPfreeBlockMemory(scip, probdata);
211
212 return SCIP_OKAY;
213}
214
215/** create initial columns */
216static
218 SCIP* scip, /**< SCIP data structure */
219 SCIP_PROBDATA* probdata /**< problem data */
220 )
221{
222 SCIP_CONS** conss;
223 SCIP_VARDATA* vardata;
224 SCIP_VAR* var;
225 char name[SCIP_MAXSTRLEN];
226
227 int* ids;
228 int nitems;
229
230 int i;
231
232 conss = probdata->conss;
233 ids = probdata->ids;
234 nitems = probdata->nitems;
235
236 /* create start solution each item in exactly one bin */
237 for( i = 0; i < nitems; ++i )
238 {
239 int a;
240
241 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "item_%d", ids[i]);
242
243 SCIPdebugMsg(scip, "create variable for item %d with weight = %"SCIP_LONGINT_FORMAT"\n", ids[i], probdata->weights[i]);
244
245 /* create variable for the packing pattern which contains only this item */
246 SCIP_CALL( SCIPcreateVarBinpacking(scip, &var, name, 1.0, TRUE, TRUE, NULL) );
247
248 /* add variable to the problem */
249 SCIP_CALL( SCIPaddVar(scip, var) );
250
251 /* store variable in the problme data */
252 SCIP_CALL( SCIPprobdataAddVar(scip, probdata, var) );
253
254 /* add variable to corresponding set covering constraint */
255 SCIP_CALL( SCIPaddCoefSetppc(scip, conss[i], var) );
256
257 /* create the variable data for the variable; the variable data contains the information in which constraints the
258 * variable appears */
259 a = i;
260 SCIP_CALL( SCIPvardataCreateBinpacking(scip, &vardata, &a, 1) );
261
262 /* add the variable data to the variable */
263 SCIPvarSetData(var, vardata);
264
265 /* change the upper bound of the binary variable to lazy since the upper bound is already enforced
266 * due to the objective function the set covering constraint;
267 * The reason for doing is that, is to avoid the bound of x <= 1 in the LP relaxation since this bound
268 * constraint would produce a dual variable which might have a positive reduced cost
269 */
270 SCIP_CALL( SCIPchgVarUbLazy(scip, var, 1.0) );
271
272 /* release variable */
273 SCIP_CALL( SCIPreleaseVar(scip, &var) );
274 }
275
276 return SCIP_OKAY;
277}
278
279/**@} */
280
281/**@name Callback methods of problem data
282 *
283 * @{
284 */
285
286/** frees user data of original problem (called when the original problem is freed) */
287static
288SCIP_DECL_PROBDELORIG(probdelorigBinpacking)
289{
290 SCIPdebugMsg(scip, "free original problem data\n");
291
292 SCIP_CALL( probdataFree(scip, probdata) );
293
294 return SCIP_OKAY;
295}
296
297/** creates user data of transformed problem by transforming the original user problem data
298 * (called after problem was transformed) */
299static
300SCIP_DECL_PROBTRANS(probtransBinpacking)
301{
302 /* create transform probdata */
303 SCIP_CALL( probdataCreate(scip, targetdata, sourcedata->vars, sourcedata->conss, sourcedata->weights, sourcedata->ids,
304 sourcedata->nvars, sourcedata->nitems, sourcedata->capacity) );
305
306 /* transform all constraints */
307 SCIP_CALL( SCIPtransformConss(scip, (*targetdata)->nitems, (*targetdata)->conss, (*targetdata)->conss) );
308
309 /* transform all variables */
310 SCIP_CALL( SCIPtransformVars(scip, (*targetdata)->nvars, (*targetdata)->vars, (*targetdata)->vars) );
311
312 return SCIP_OKAY;
313}
314
315/** frees user data of transformed problem (called when the transformed problem is freed) */
316static
317SCIP_DECL_PROBDELTRANS(probdeltransBinpacking)
318{
319 SCIPdebugMsg(scip, "free transformed problem data\n");
320
321 SCIP_CALL( probdataFree(scip, probdata) );
322
323 return SCIP_OKAY;
324}
325
326/** solving process initialization method of transformed data (called before the branch and bound process begins) */
327static
328SCIP_DECL_PROBINITSOL(probinitsolBinpacking)
329{
330 SCIP_EVENTHDLR* eventhdlr;
331
332 assert(probdata != NULL);
333
334 /* catch variable added event */
335 eventhdlr = SCIPfindEventhdlr(scip, "addedvar");
336 assert(eventhdlr != NULL);
337
339
340 return SCIP_OKAY;
341}
342
343/** solving process deinitialization method of transformed data (called before the branch and bound data is freed) */
344static
345SCIP_DECL_PROBEXITSOL(probexitsolBinpacking)
346{ /*lint --e{715}*/
347 SCIP_EVENTHDLR* eventhdlr;
348
349 assert(probdata != NULL);
350
351 /* drop variable added event */
352 eventhdlr = SCIPfindEventhdlr(scip, "addedvar");
353 assert(eventhdlr != NULL);
354
356
357 return SCIP_OKAY;
358}
359
360/**@} */
361
362
363/**@name Interface methods
364 *
365 * @{
366 */
367
368/** sets up the problem data */
370 SCIP* scip, /**< SCIP data structure */
371 const char* probname, /**< problem name */
372 int* ids, /**< array of item ids */
373 SCIP_Longint* weights, /**< array containing the item weights */
374 int nitems, /**< number of items */
375 SCIP_Longint capacity /**< bin capacity */
376 )
377{
378 SCIP_PROBDATA* probdata;
379 SCIP_CONS** conss;
380 char name[SCIP_MAXSTRLEN];
381 int i;
382
383 assert(scip != NULL);
384
385 /* create event handler if it does not exist yet */
387 {
389 }
390
391 /* create problem in SCIP and add non-NULL callbacks via setter functions */
392 SCIP_CALL( SCIPcreateProbBasic(scip, probname) );
393
394 SCIP_CALL( SCIPsetProbDelorig(scip, probdelorigBinpacking) );
395 SCIP_CALL( SCIPsetProbTrans(scip, probtransBinpacking) );
396 SCIP_CALL( SCIPsetProbDeltrans(scip, probdeltransBinpacking) );
397 SCIP_CALL( SCIPsetProbInitsol(scip, probinitsolBinpacking) );
398 SCIP_CALL( SCIPsetProbExitsol(scip, probexitsolBinpacking) );
399
400 /* set objective sense */
402
403 /* tell SCIP that the objective will be always integral */
405
406 SCIP_CALL( SCIPallocBufferArray(scip, &conss, nitems) );
407
408 /* create set covering constraints for each item */
409 for( i = 0; i < nitems; ++i )
410 {
411 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "item_%d", ids[i]);
412
413 SCIP_CALL( SCIPcreateConsBasicSetcover(scip, &conss[i], name, 0, NULL) );
414
415 /* declare constraint modifiable for adding variables during pricing */
417 SCIP_CALL( SCIPaddCons(scip, conss[i]) );
418 }
419
420 /* create problem data */
421 SCIP_CALL( probdataCreate(scip, &probdata, NULL, conss, weights, ids, 0, nitems, capacity) );
422
423 SCIP_CALL( createInitialColumns(scip, probdata) );
424
425 /* set user problem data */
426 SCIP_CALL( SCIPsetProbData(scip, probdata) );
427
428 SCIP_CALL( SCIPpricerBinpackingActivate(scip, conss, weights, ids, nitems, capacity) );
429
430 /* free local buffer arrays */
431 SCIPfreeBufferArray(scip, &conss);
432
433 return SCIP_OKAY;
434}
435
436/** returns array of item ids */
438 SCIP_PROBDATA* probdata /**< problem data */
439 )
440{
441 return probdata->ids;
442}
443
444/** returns array of item weights */
446 SCIP_PROBDATA* probdata /**< problem data */
447 )
448{
449 return probdata->weights;
450}
451
452/** returns number of items */
454 SCIP_PROBDATA* probdata /**< problem data */
455 )
456{
457 return probdata->nitems;
458}
459
460/** returns bin capacity */
462 SCIP_PROBDATA* probdata /**< problem data */
463 )
464{
465 return probdata->capacity;
466}
467
468/** returns array of all variables itemed in the way they got generated */
470 SCIP_PROBDATA* probdata /**< problem data */
471 )
472{
473 return probdata->vars;
474}
475
476/** returns number of variables */
478 SCIP_PROBDATA* probdata /**< problem data */
479 )
480{
481 return probdata->nvars;
482}
483
484/** returns array of set partitioning constrains */
486 SCIP_PROBDATA* probdata /**< problem data */
487 )
488{
489 return probdata->conss;
490}
491
492/** adds given variable to the problem data */
494 SCIP* scip, /**< SCIP data structure */
495 SCIP_PROBDATA* probdata, /**< problem data */
496 SCIP_VAR* var /**< variables to add */
497 )
498{
499 /* check if enough memory is left */
500 if( probdata->varssize == probdata->nvars )
501 {
502 int newsize;
503 newsize = MAX(100, probdata->varssize * 2);
504 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &probdata->vars, probdata->varssize, newsize) );
505 probdata->varssize = newsize;
506 }
507
508 /* caputure variables */
510
511 probdata->vars[probdata->nvars] = var;
512 probdata->nvars++;
513
514 SCIPdebugMsg(scip, "added variable to probdata; nvars = %d\n", probdata->nvars);
515
516 return SCIP_OKAY;
517}
518
519/**@} */
SCIP_VAR * a
Definition: circlepacking.c:66
Constraint handler for the set partitioning / packing / covering constraints .
#define NULL
Definition: def.h:248
#define SCIP_MAXSTRLEN
Definition: def.h:269
#define SCIP_Longint
Definition: def.h:141
#define TRUE
Definition: def.h:93
#define MAX(x, y)
Definition: def.h:220
#define SCIP_LONGINT_FORMAT
Definition: def.h:148
#define SCIP_CALL(x)
Definition: def.h:355
SCIP_RETCODE SCIPcreateConsBasicSetcover(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars)
Definition: cons_setppc.c:9558
SCIP_RETCODE SCIPaddCoefSetppc(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
Definition: cons_setppc.c:9573
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
Definition: scip_prob.c:1907
SCIP_RETCODE SCIPsetObjIntegral(SCIP *scip)
Definition: scip_prob.c:1758
SCIP_RETCODE SCIPsetProbDeltrans(SCIP *scip, SCIP_DECL_PROBDELTRANS((*probdeltrans)))
Definition: scip_prob.c:244
SCIP_RETCODE SCIPsetProbExitsol(SCIP *scip, SCIP_DECL_PROBEXITSOL((*probexitsol)))
Definition: scip_prob.c:287
SCIP_RETCODE SCIPsetProbTrans(SCIP *scip, SCIP_DECL_PROBTRANS((*probtrans)))
Definition: scip_prob.c:223
SCIP_RETCODE SCIPsetProbDelorig(SCIP *scip, SCIP_DECL_PROBDELORIG((*probdelorig)))
Definition: scip_prob.c:202
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
Definition: scip_prob.c:3274
SCIP_PROBDATA * SCIPgetProbData(SCIP *scip)
Definition: scip_prob.c:1139
SCIP_RETCODE SCIPsetProbInitsol(SCIP *scip, SCIP_DECL_PROBINITSOL((*probinitsol)))
Definition: scip_prob.c:265
SCIP_RETCODE SCIPsetObjsense(SCIP *scip, SCIP_OBJSENSE objsense)
Definition: scip_prob.c:1417
SCIP_RETCODE SCIPcreateProbBasic(SCIP *scip, const char *name)
Definition: scip_prob.c:182
SCIP_RETCODE SCIPsetProbData(SCIP *scip, SCIP_PROBDATA *probdata)
Definition: scip_prob.c:1189
#define SCIPdebugMsg
Definition: scip_message.h:78
SCIP_RETCODE SCIPtransformConss(SCIP *scip, int nconss, SCIP_CONS **conss, SCIP_CONS **transconss)
Definition: scip_cons.c:1625
SCIP_RETCODE SCIPsetConsModifiable(SCIP *scip, SCIP_CONS *cons, SCIP_Bool modifiable)
Definition: scip_cons.c:1424
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
Definition: scip_cons.c:1173
SCIP_RETCODE SCIPincludeEventhdlrBasic(SCIP *scip, SCIP_EVENTHDLR **eventhdlrptr, const char *name, const char *desc, SCIP_DECL_EVENTEXEC((*eventexec)), SCIP_EVENTHDLRDATA *eventhdlrdata)
Definition: scip_event.c:111
SCIP_EVENTHDLR * SCIPfindEventhdlr(SCIP *scip, const char *name)
Definition: scip_event.c:241
const char * SCIPeventhdlrGetName(SCIP_EVENTHDLR *eventhdlr)
Definition: event.c:396
SCIP_EVENTTYPE SCIPeventGetType(SCIP_EVENT *event)
Definition: event.c:1194
SCIP_VAR * SCIPeventGetVar(SCIP_EVENT *event)
Definition: event.c:1217
SCIP_RETCODE SCIPcatchEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
Definition: scip_event.c:293
SCIP_RETCODE SCIPdropEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
Definition: scip_event.c:333
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
Definition: scip_mem.h:110
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip_mem.h:124
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip_mem.h:136
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
Definition: scip_mem.h:99
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip_mem.h:108
#define SCIPallocBlockMemory(scip, ptr)
Definition: scip_mem.h:89
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
Definition: scip_mem.h:105
SCIP_RETCODE SCIPtransformVars(SCIP *scip, int nvars, SCIP_VAR **vars, SCIP_VAR **transvars)
Definition: scip_var.c:2028
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
Definition: scip_var.c:1887
void SCIPvarSetData(SCIP_VAR *var, SCIP_VARDATA *vardata)
Definition: var.c:23297
SCIP_RETCODE SCIPchgVarUbLazy(SCIP *scip, SCIP_VAR *var, SCIP_Real lazyub)
Definition: scip_var.c:6362
SCIP_RETCODE SCIPcaptureVar(SCIP *scip, SCIP_VAR *var)
Definition: scip_var.c:1853
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10827
SCIP_RETCODE SCIPpricerBinpackingActivate(SCIP *scip, SCIP_CONS **conss, SCIP_Longint *weights, int *ids, int nitems, SCIP_Longint capacity)
Binpacking variable pricer.
static SCIP_DECL_PROBEXITSOL(probexitsolBinpacking)
SCIP_Longint SCIPprobdataGetCapacity(SCIP_PROBDATA *probdata)
static SCIP_DECL_EVENTEXEC(eventExecAddedVar)
static SCIP_DECL_PROBDELTRANS(probdeltransBinpacking)
static SCIP_DECL_PROBDELORIG(probdelorigBinpacking)
static SCIP_DECL_PROBTRANS(probtransBinpacking)
SCIP_Longint * SCIPprobdataGetWeights(SCIP_PROBDATA *probdata)
SCIP_CONS ** SCIPprobdataGetConss(SCIP_PROBDATA *probdata)
static SCIP_RETCODE probdataCreate(SCIP *scip, SCIP_PROBDATA **probdata, SCIP_VAR **vars, SCIP_CONS **conss, SCIP_Longint *weights, int *ids, int nvars, int nitems, SCIP_Longint capacity)
static SCIP_DECL_PROBINITSOL(probinitsolBinpacking)
SCIP_RETCODE SCIPprobdataAddVar(SCIP *scip, SCIP_PROBDATA *probdata, SCIP_VAR *var)
int * SCIPprobdataGetIds(SCIP_PROBDATA *probdata)
static SCIP_RETCODE createInitialColumns(SCIP *scip, SCIP_PROBDATA *probdata)
SCIP_RETCODE SCIPprobdataCreate(SCIP *scip, const char *probname, int *ids, SCIP_Longint *weights, int nitems, SCIP_Longint capacity)
int SCIPprobdataGetNVars(SCIP_PROBDATA *probdata)
#define EVENTHDLR_DESC
SCIP_VAR ** SCIPprobdataGetVars(SCIP_PROBDATA *probdata)
static SCIP_RETCODE probdataFree(SCIP *scip, SCIP_PROBDATA **probdata)
#define EVENTHDLR_NAME
int SCIPprobdataGetNItems(SCIP_PROBDATA *probdata)
Problem data for binpacking problem.
SCIP callable library.
#define SCIP_EVENTTYPE_VARADDED
Definition: type_event.h:70
struct SCIP_ProbData SCIP_PROBDATA
Definition: type_prob.h:53
@ SCIP_OBJSENSE_MINIMIZE
Definition: type_prob.h:48
@ SCIP_OKAY
Definition: type_retcode.h:42
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
struct SCIP_VarData SCIP_VARDATA
Definition: type_var.h:167
SCIP_RETCODE SCIPcreateVarBinpacking(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real obj, SCIP_Bool initial, SCIP_Bool removable, SCIP_VARDATA *vardata)
SCIP_RETCODE SCIPvardataCreateBinpacking(SCIP *scip, SCIP_VARDATA **vardata, int *consids, int nconsids)
Variable data containing the ids of constraints in which the variable appears.