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-2024 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 SCIP_Longint* weights;
229 int nitems;
230
231 int i;
232
233 conss = probdata->conss;
234 ids = probdata->ids;
235 weights = probdata->weights;
236 nitems = probdata->nitems;
237
238 /* create start solution each item in exactly one bin */
239 for( i = 0; i < nitems; ++i )
240 {
241 int a;
242
243 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "item_%d", ids[i]);
244
245 SCIPdebugMsg(scip, "create variable for item %d with weight = %"SCIP_LONGINT_FORMAT"\n", ids[i], weights[i]);
246
247 /* create variable for the packing pattern which contains only this item */
248 SCIP_CALL( SCIPcreateVarBinpacking(scip, &var, name, 1.0, TRUE, TRUE, NULL) );
249
250 /* add variable to the problem */
251 SCIP_CALL( SCIPaddVar(scip, var) );
252
253 /* store variable in the problme data */
254 SCIP_CALL( SCIPprobdataAddVar(scip, probdata, var) );
255
256 /* add variable to corresponding set covering constraint */
257 SCIP_CALL( SCIPaddCoefSetppc(scip, conss[i], var) );
258
259 /* create the variable data for the variable; the variable data contains the information in which constraints the
260 * variable appears */
261 a = i;
262 SCIP_CALL( SCIPvardataCreateBinpacking(scip, &vardata, &a, 1) );
263
264 /* add the variable data to the variable */
265 SCIPvarSetData(var, vardata);
266
267 /* change the upper bound of the binary variable to lazy since the upper bound is already enforced
268 * due to the objective function the set covering constraint;
269 * The reason for doing is that, is to avoid the bound of x <= 1 in the LP relaxation since this bound
270 * constraint would produce a dual variable which might have a positive reduced cost
271 */
272 SCIP_CALL( SCIPchgVarUbLazy(scip, var, 1.0) );
273
274 /* release variable */
275 SCIP_CALL( SCIPreleaseVar(scip, &var) );
276 }
277
278 return SCIP_OKAY;
279}
280
281/**@} */
282
283/**@name Callback methods of problem data
284 *
285 * @{
286 */
287
288/** frees user data of original problem (called when the original problem is freed) */
289static
290SCIP_DECL_PROBDELORIG(probdelorigBinpacking)
291{
292 SCIPdebugMsg(scip, "free original problem data\n");
293
294 SCIP_CALL( probdataFree(scip, probdata) );
295
296 return SCIP_OKAY;
297}
298
299/** creates user data of transformed problem by transforming the original user problem data
300 * (called after problem was transformed) */
301static
302SCIP_DECL_PROBTRANS(probtransBinpacking)
303{
304 /* create transform probdata */
305 SCIP_CALL( probdataCreate(scip, targetdata, sourcedata->vars, sourcedata->conss, sourcedata->weights, sourcedata->ids,
306 sourcedata->nvars, sourcedata->nitems, sourcedata->capacity) );
307
308 /* transform all constraints */
309 SCIP_CALL( SCIPtransformConss(scip, (*targetdata)->nitems, (*targetdata)->conss, (*targetdata)->conss) );
310
311 /* transform all variables */
312 SCIP_CALL( SCIPtransformVars(scip, (*targetdata)->nvars, (*targetdata)->vars, (*targetdata)->vars) );
313
314 return SCIP_OKAY;
315}
316
317/** frees user data of transformed problem (called when the transformed problem is freed) */
318static
319SCIP_DECL_PROBDELTRANS(probdeltransBinpacking)
320{
321 SCIPdebugMsg(scip, "free transformed problem data\n");
322
323 SCIP_CALL( probdataFree(scip, probdata) );
324
325 return SCIP_OKAY;
326}
327
328/** solving process initialization method of transformed data (called before the branch and bound process begins) */
329static
330SCIP_DECL_PROBINITSOL(probinitsolBinpacking)
331{
332 SCIP_EVENTHDLR* eventhdlr;
333
334 assert(probdata != NULL);
335
336 /* catch variable added event */
337 eventhdlr = SCIPfindEventhdlr(scip, "addedvar");
338 assert(eventhdlr != NULL);
339
341
342 return SCIP_OKAY;
343}
344
345/** solving process deinitialization method of transformed data (called before the branch and bound data is freed) */
346static
347SCIP_DECL_PROBEXITSOL(probexitsolBinpacking)
348{ /*lint --e{715}*/
349 SCIP_EVENTHDLR* eventhdlr;
350
351 assert(probdata != NULL);
352
353 /* drop variable added event */
354 eventhdlr = SCIPfindEventhdlr(scip, "addedvar");
355 assert(eventhdlr != NULL);
356
358
359 return SCIP_OKAY;
360}
361
362/**@} */
363
364
365/**@name Interface methods
366 *
367 * @{
368 */
369
370/** sets up the problem data */
372 SCIP* scip, /**< SCIP data structure */
373 const char* probname, /**< problem name */
374 int* ids, /**< array of item ids */
375 SCIP_Longint* weights, /**< array containing the item weights */
376 int nitems, /**< number of items */
377 SCIP_Longint capacity /**< bin capacity */
378 )
379{
380 SCIP_PROBDATA* probdata;
381 SCIP_CONS** conss;
382 char name[SCIP_MAXSTRLEN];
383 int i;
384
385 assert(scip != NULL);
386
387 /* create event handler if it does not exist yet */
389 {
391 }
392
393 /* create problem in SCIP and add non-NULL callbacks via setter functions */
394 SCIP_CALL( SCIPcreateProbBasic(scip, probname) );
395
396 SCIP_CALL( SCIPsetProbDelorig(scip, probdelorigBinpacking) );
397 SCIP_CALL( SCIPsetProbTrans(scip, probtransBinpacking) );
398 SCIP_CALL( SCIPsetProbDeltrans(scip, probdeltransBinpacking) );
399 SCIP_CALL( SCIPsetProbInitsol(scip, probinitsolBinpacking) );
400 SCIP_CALL( SCIPsetProbExitsol(scip, probexitsolBinpacking) );
401
402 /* set objective sense */
404
405 /* tell SCIP that the objective will be always integral */
407
408 SCIP_CALL( SCIPallocBufferArray(scip, &conss, nitems) );
409
410 /* create set covering constraints for each item */
411 for( i = 0; i < nitems; ++i )
412 {
413 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "item_%d", ids[i]);
414
415 SCIP_CALL( SCIPcreateConsBasicSetcover(scip, &conss[i], name, 0, NULL) );
416
417 /* declare constraint modifiable for adding variables during pricing */
419 SCIP_CALL( SCIPaddCons(scip, conss[i]) );
420 }
421
422 /* create problem data */
423 SCIP_CALL( probdataCreate(scip, &probdata, NULL, conss, weights, ids, 0, nitems, capacity) );
424
425 SCIP_CALL( createInitialColumns(scip, probdata) );
426
427 /* set user problem data */
428 SCIP_CALL( SCIPsetProbData(scip, probdata) );
429
430 SCIP_CALL( SCIPpricerBinpackingActivate(scip, conss, weights, ids, nitems, capacity) );
431
432 /* free local buffer arrays */
433 SCIPfreeBufferArray(scip, &conss);
434
435 return SCIP_OKAY;
436}
437
438/** returns array of item ids */
440 SCIP_PROBDATA* probdata /**< problem data */
441 )
442{
443 return probdata->ids;
444}
445
446/** returns array of item weights */
448 SCIP_PROBDATA* probdata /**< problem data */
449 )
450{
451 return probdata->weights;
452}
453
454/** returns number of items */
456 SCIP_PROBDATA* probdata /**< problem data */
457 )
458{
459 return probdata->nitems;
460}
461
462/** returns bin capacity */
464 SCIP_PROBDATA* probdata /**< problem data */
465 )
466{
467 return probdata->capacity;
468}
469
470/** returns array of all variables itemed in the way they got generated */
472 SCIP_PROBDATA* probdata /**< problem data */
473 )
474{
475 return probdata->vars;
476}
477
478/** returns number of variables */
480 SCIP_PROBDATA* probdata /**< problem data */
481 )
482{
483 return probdata->nvars;
484}
485
486/** returns array of set partitioning constrains */
488 SCIP_PROBDATA* probdata /**< problem data */
489 )
490{
491 return probdata->conss;
492}
493
494/** adds given variable to the problem data */
496 SCIP* scip, /**< SCIP data structure */
497 SCIP_PROBDATA* probdata, /**< problem data */
498 SCIP_VAR* var /**< variables to add */
499 )
500{
501 /* check if enough memory is left */
502 if( probdata->varssize == probdata->nvars )
503 {
504 int newsize;
505 newsize = MAX(100, probdata->varssize * 2);
506 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &probdata->vars, probdata->varssize, newsize) );
507 probdata->varssize = newsize;
508 }
509
510 /* caputure variables */
512
513 probdata->vars[probdata->nvars] = var;
514 probdata->nvars++;
515
516 SCIPdebugMsg(scip, "added variable to probdata; nvars = %d\n", probdata->nvars);
517
518 return SCIP_OKAY;
519}
520
521/**@} */
SCIP_VAR * a
Definition: circlepacking.c:66
Constraint handler for the set partitioning / packing / covering constraints .
#define NULL
Definition: def.h:266
#define SCIP_MAXSTRLEN
Definition: def.h:287
#define SCIP_Longint
Definition: def.h:157
#define TRUE
Definition: def.h:93
#define MAX(x, y)
Definition: def.h:238
#define SCIP_LONGINT_FORMAT
Definition: def.h:164
#define SCIP_CALL(x)
Definition: def.h:373
SCIP_RETCODE SCIPcreateConsBasicSetcover(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars)
Definition: cons_setppc.c:9524
SCIP_RETCODE SCIPaddCoefSetppc(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
Definition: cons_setppc.c:9539
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
Definition: scip_prob.c:1668
SCIP_RETCODE SCIPsetObjIntegral(SCIP *scip)
Definition: scip_prob.c:1519
SCIP_RETCODE SCIPsetProbDeltrans(SCIP *scip, SCIP_DECL_PROBDELTRANS((*probdeltrans)))
Definition: scip_prob.c:242
SCIP_RETCODE SCIPsetProbExitsol(SCIP *scip, SCIP_DECL_PROBEXITSOL((*probexitsol)))
Definition: scip_prob.c:285
SCIP_RETCODE SCIPsetProbTrans(SCIP *scip, SCIP_DECL_PROBTRANS((*probtrans)))
Definition: scip_prob.c:221
SCIP_RETCODE SCIPsetProbDelorig(SCIP *scip, SCIP_DECL_PROBDELORIG((*probdelorig)))
Definition: scip_prob.c:200
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
Definition: scip_prob.c:2770
SCIP_PROBDATA * SCIPgetProbData(SCIP *scip)
Definition: scip_prob.c:964
SCIP_RETCODE SCIPsetProbInitsol(SCIP *scip, SCIP_DECL_PROBINITSOL((*probinitsol)))
Definition: scip_prob.c:263
SCIP_RETCODE SCIPsetObjsense(SCIP *scip, SCIP_OBJSENSE objsense)
Definition: scip_prob.c:1242
SCIP_RETCODE SCIPcreateProbBasic(SCIP *scip, const char *name)
Definition: scip_prob.c:180
SCIP_RETCODE SCIPsetProbData(SCIP *scip, SCIP_PROBDATA *probdata)
Definition: scip_prob.c:1014
#define SCIPdebugMsg
Definition: scip_message.h:78
SCIP_RETCODE SCIPtransformConss(SCIP *scip, int nconss, SCIP_CONS **conss, SCIP_CONS **transconss)
Definition: scip_cons.c:1626
SCIP_RETCODE SCIPsetConsModifiable(SCIP *scip, SCIP_CONS *cons, SCIP_Bool modifiable)
Definition: scip_cons.c:1425
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
Definition: scip_cons.c:1174
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:104
SCIP_EVENTHDLR * SCIPfindEventhdlr(SCIP *scip, const char *name)
Definition: scip_event.c:234
const char * SCIPeventhdlrGetName(SCIP_EVENTHDLR *eventhdlr)
Definition: event.c:324
SCIP_EVENTTYPE SCIPeventGetType(SCIP_EVENT *event)
Definition: event.c:1030
SCIP_VAR * SCIPeventGetVar(SCIP_EVENT *event)
Definition: event.c:1053
SCIP_RETCODE SCIPcatchEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
Definition: scip_event.c:286
SCIP_RETCODE SCIPdropEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
Definition: scip_event.c:320
#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:1389
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
Definition: scip_var.c:1248
void SCIPvarSetData(SCIP_VAR *var, SCIP_VARDATA *vardata)
Definition: var.c:17448
SCIP_RETCODE SCIPchgVarUbLazy(SCIP *scip, SCIP_VAR *var, SCIP_Real lazyub)
Definition: scip_var.c:5287
SCIP_RETCODE SCIPcaptureVar(SCIP *scip, SCIP_VAR *var)
Definition: scip_var.c:1214
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10880
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:120
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.