GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
class_detprobdata.h
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
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-2026 Operations Research, RWTH Aachen University */
10/* Zuse Institute Berlin (ZIB) */
11/* */
12/* Licensed under the Apache License, Version 2.0 (the "License"); */
13/* you may not use this file except in compliance with the License. */
14/* You may obtain a copy of the License at */
15/* */
16/* http://www.apache.org/licenses/LICENSE-2.0 */
17/* */
18/* Unless required by applicable law or agreed to in writing, software */
19/* distributed under the License is distributed on an "AS IS" BASIS, */
20/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
21/* See the License for the specific language governing permissions and */
22/* limitations under the License. */
23/* */
24/* You should have received a copy of the Apache-2.0 license */
25/* along with GCG; see the file LICENSE. If not visit gcg.or.rwth-aachen.de.*/
26/* */
27/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
28
29/**@file class_detprobdata.h
30 * @ingroup DECOMP
31 * @brief class storing partialdecs and the problem matrix
32 * @note formerly called "Seeedpool"
33 * @author Michael Bastubbe
34 * @author Julius Hense
35 * @author Hanna Franzen
36 */
37
38/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
39
40#ifndef GCG_CLASS_DETPROBDATA_H__
41#define GCG_CLASS_DETPROBDATA_H__
42
43#include <vector>
44
45#if __cplusplus >= 201103L || defined(_MSC_VER)
46#include <unordered_map>
47using std::unordered_map;
48#else
49#include <tr1/unordered_map>
50using std::tr1::unordered_map;
51#endif
52
53#include <functional>
54#include <string>
55#include <utility>
56#include "gcg/gcg.h"
57
58
62
63/** constraint type */
84
85
86namespace gcg{
87
88/**
89 * @brief combine two hash function of objects of a pair to get a vaulue for the pair
90 */
92{
93 template<class T1, class T2>
94 std::size_t operator()(
95 const std::pair<T1, T2> &p) const
96 {
97 auto h1 = std::hash<T1>{}( p.first );
98 auto h2 = std::hash<T2>{}( p.second );
99
100 /* overly simple hash combination */
101 return h1 ^ h2;
102 }
103};
104
105/**
106 * class to manage the detection process and data for one coefficient matrix of a MIP, usually there is one detprobdata for the original and one detprobdata for the presolved problem
107 * @ingroup DECOMP
108 */
110{ /*lint -esym(1712,DETPROBDATA)*/
111
112private:
113 GCG* gcg; /**< GCG data structure */
114 SCIP* scip; /**< SCIP data structure */
115 std::vector<PARTIALDECOMP*> openpartialdecs; /**< vector of open partialdecs */
116 std::vector<PARTIALDECOMP*> finishedpartialdecs; /**< vector of finished partialdecs */
117 std::vector<PARTIALDECOMP*> ancestorpartialdecs; /**< old partialdecs that were previously used */
118
119 std::vector<SCIP_CONS*> relevantconss; /**< stores all constraints that are not marked as deleted or obsolete */
120 std::vector<SCIP_VAR*> relevantvars; /**< stores all prob variables that are not fixed to 0 */
121 std::vector<std::vector<int>> varsforconss; /**< stores for every constraint the indices of variables
122 *< that are contained in the constraint */
123 std::vector<std::vector<double>> valsforconss; /**< stores for every constraint the coefficients of
124 *< variables that are contained in the constraint (i.e.
125 *< have a nonzero coefficient) */
126 std::vector<std::vector<int>> conssforvars; /**< stores for every variable the indices of constraints
127 *< containing this variable */
128
129 std::vector<std::vector<int>> conssadjacencies;
130 unordered_map<SCIP_CONS*, int> constoindex; /**< maps SCIP_CONS* to the corresponding internal index */
131 unordered_map<SCIP_VAR*, int> vartoindex; /**< maps SCIP_VAR* to the corresponding internal index */
132
133 unordered_map<std::pair<int, int>, SCIP_Real, pair_hash> valsMap; /**< maps an entry of the matrix to its
134 *< value, zeros are omitted */
135
136 std::vector<SCIP_VAR*> origfixedtozerovars; /**< collection of SCIP_VAR* that are fixed to zero in transformed problem*/
137
138 int nvars; /**< number of variables */
139 int nconss; /**< number of constraints */
140 int nnonzeros; /**< number of nonzero entries in the coefficient matrix */
141
142 SCIP_Bool original; /**< corresponds the matrix data structure to the original
143 *< problem */
144
145public:
146 std::vector<std::pair<int, int>> candidatesNBlocks; /**< candidate for the number of blocks, second int indicates how often a candidate was added */
147
148 std::vector<ConsPartition*> conspartitioncollection; /**< collection of different constraint class distributions */
149 std::vector<VarPartition*> varpartitioncollection; /**< collection of different variable class distributions */
150
151 SCIP_Real classificationtime; /**< time that was consumed by the classification of the constraint and variables classifiers */
152 SCIP_Real nblockscandidatescalctime; /**< time that was used to calulate the candidates of te block number */
153 SCIP_Real postprocessingtime; /**< time that was spent in postproceesing decomposigtions */
154 SCIP_Real translatingtime; /**< time that was spent by transforming partialdecs between presolved and orig problem */
155
156private:
157
158 /**
159 * @brief calculates necessary data for translating partialdecs and partitions
160 */
161 void calcTranslationMapping(
162 DETPROBDATA* origdata, /** original detprobdata */
163 std::vector<int>& rowothertothis, /** constraint index mapping from old to new detprobdata */
164 std::vector<int>& rowthistoother, /** constraint index mapping new to old detprobdata */
165 std::vector<int>& colothertothis, /** variable index mapping from old to new detprobdata */
166 std::vector<int>& colthistoother, /** variable index mapping from new to old detprobdata */
167 std::vector<int>& missingrowinthis /** missing constraint indices in new detprobdata */
168 );
169
170 /**
171 * @brief returns translated partialdecs derived from given mapping data
172
173 * @return vector of translated partialdec pointers
174 */
175 void getTranslatedPartialdecs(
176 std::vector<PARTIALDECOMP*>& otherpartialdecs, /**< partialdecs to be translated */
177 std::vector<int>& rowothertothis, /** constraint index mapping from old to new detprobdata */
178 std::vector<int>& rowthistoother, /** constraint index mapping new to old detprobdata */
179 std::vector<int>& colothertothis, /** variable index mapping from old to new detprobdata */
180 std::vector<int>& colthistoother, /** variable index mapping from new to old detprobdata */
181 std::vector<PARTIALDECOMP*>& translatedpartialdecs, /**< will contain translated partialdecs */
182 SCIP_Bool translatesymmetry /**< translate symmetry information (the old/original information must be valid for each translated partialdec!) */
183 );
184
185public:
186
187 /**
188 * @brief constructor
189 * @param scip SCIP data structure
190 * @param _originalProblem true iff the detprobdata is created for the presolved problem
191 */
194 GCG* gcgstruct,
195 SCIP_Bool _originalProblem
196 );
197
198 /**
199 * destructor
200 */
202 ~DETPROBDATA();
203
204 /**
205 * @brief adds a constraint partition if it is no duplicate of an existing constraint partition
206 */
208 void addConsPartition(
209 ConsPartition* partition /**< conspartition to be added*/
210 );
211
212 /**
213 * @brief adds a candidate for block number and counts how often a candidate is added
214 */
217 int candidate, /**< candidate for block size */
218 int nvotes /**< number of votes this candidates will get */
219 );
220
221 /**
222 * @brief adds a partialdec to ancestor partialdecs
223 * @param partialdec partialdec that is added to the ancestor partialdecs
224 */
227 PARTIALDECOMP* partialdec
228 );
229
230 /**
231 * @brief adds a partialdec to current partialdecs (data structure for partialdecs that are goin to processed in the propagation rounds)
232 * @param partialdec pointer of partialdec to be added
233 * @returns TRUE if the partialdecs was successfully added (i.e. it is no duplicate of a known partialdec)
234 */
237 PARTIALDECOMP* partialdec
238 );
239
240 /**
241 * @brief adds a partialdec to finished partialdecs
242 * @param partialdec pointer of partialdec that is going to be added to the finished partialdecs (data structure to carry finished decompositions)
243 * @returns TRUE if the partialdecs was successfully added (i.e. it is no duplicate of a known partialdec)
244 * @see addPartialdecToFinishedUnchecked()
245 */
248 PARTIALDECOMP* partialdec
249 );
250
251 /**
252 * @brief adds a partialdec to finished partialdecs without checking for duplicates, dev has to check this on his own
253 * @param partialdec pointer of partialdec that is going to be added unchecked to the finished partialdecs (data structure to carry finished decompositions)
254 * @see addPartialdecToFinished()
255 */
258 PARTIALDECOMP* partialdec
259 );
260
261 /**
262 * @brief adds a variable partition if it is no duplicate of an existing variable partition
263 * @param partition varpartition to be added
264 */
266 void addVarPartition(
267 VarPartition* partition
268 );
269
270 /**
271 * @brief clears ancestor partialdec data structure,
272 * @note does not free the partialdecs themselves
273 */
276
277 /**
278 * @brief clears current partialdec data structure
279 * @note does not free the partialdecs themselves
280 */
283
284 /**
285 * @brief clears finished partialdec data structure
286 *
287 * @note does not free the partialdecs themselves
288 */
291
292 /**
293 * @brief create the constraint adjacency datastructure that is used (if created) for some methods to faster access the constarints that have variables in common
294 */
297
298 /**
299 * @brief frees temporary data that is only needed during the detection process
300 */
302 void freeTemporaryData();
303
304 /**
305 * @brief returns a partialdec from ancestor partialdec data structure with given index
306 *
307 * @returns partialdec from ancestor partialdec data structure
308 */
311 int partialdecindex /**< index of partialdec in ancestor partialdec data structure */
312 );
313
314 /**
315 * @brief returns pointer to a constraint partition
316 * @return pointer to a cosntraint partition with the given index
317 */
320 int partitionIndex /**< index of constraint partition */
321 );
322
323 /**
324 * @brief returns the SCIP constraint related to a constraint index
325 * @return the SCIP constraint related to a constraint index
326 */
329 int consIndex /**< index of the constraint to be considered */
330 );
331
332 /**
333 * @brief return array of constraint indices that have a common variable with the given constraint
334 * @return return vector of constraint indices that have a common variable with the given constraint
335 * @note constraint adjacency data structure has to initilized
336 */
338 std::vector<int>& getConssForCons(
339 int consIndex /**< index of the constraint to be considered */
340 );
341
342 /**
343 * \brief returns the constraint indices of the coefficient matrix for a variable
344 * @return vector of constraint indices that have a nonzero entry with this variable
345 */
347 std::vector<int>& getConssForVar(
348 int varIndex /**< index of the variable to be considered */
349 );
350
351 /**
352 * @brief returns the corresponding gcg data structure
353 * @return the corresponding gcg data structure
354 */
356 GCG* getGcg();
357
358 /**
359 * @brief determines all partialdecs from current (open) partialdec data structure
360 * @returns all partialdecs in current (open) partialdec data structure
361 */
363 std::vector<PARTIALDECOMP*>& getOpenPartialdecs();
364
365 /**
366 * @brief returns a partialdec from finished partialdec data structure
367 * @return partialdec from finished partialdec data structure
368 */
371 int partialdecindex /**< index of partialdec in finished partialdec data structure */
372 );
373
374 /**
375 * @brief gets all finished partialdecs
376 * @returns all finished partialdecs
377 */
379 std::vector<PARTIALDECOMP*>& getFinishedPartialdecs();
380
381 /**
382 * @brief returns the constraint index related to a SCIP constraint
383 * @param cons the SCIP constraint pointer the index is asked for
384 * @return the constraint index related to a SCIP constraint
385 */
387 int getIndexForCons(
388 SCIP_CONS* cons
389 );
390
391 /**
392 * @brief returns the constraint index related to a SCIP constraint
393 * @param consname name of the constraint the index is asked for
394 * @return the constraint index related to a SCIP constraint
395 */
397 int getIndexForCons(
398 const char* consname
399 );
400
401 /**
402 * @brief returns the variable index related to a SCIP variable
403 * @param var variable pointer the index is asked for
404 * @return the variable index related to a SCIP variable
405 */
407 int getIndexForVar(
409 );
410
411 /**
412 * @brief returns the variable index related to a SCIP variable
413 * @param varname name of the variable the index is asked for
414 * @return the variable index related to a SCIP variable
415 */
417 int getIndexForVar(
418 const char* varname
419 );
420
421 /**
422 * @brief returns size of ancestor partialdec data structure
423 * @return size of ancestor partialdec data structure
424 */
427
428 /**
429 * @brief returns number of different constraint partitions
430 * @return number of different constraint partitions
431 */
433 int getNConsPartitions();
434
435 /**
436 * @brief returns the number of variables considered in the detprobdata
437 * @return number of variables considered in the detprobdata
438 */
440 int getNConss();
441
442 /**
443 * @brief returns the number of constraints for a given constraint
444 * @return the number of constraints for a given constraint
445 */
448 int consIndex /**< index of the constraint to be considered */
449 );
450
451 /**
452 * @brief returns the number of constraints for a given variable where the var has a nonzero entry in
453 * @return the number of constraints for a given variable
454 */
456 int getNConssForVar(
457 int varIndex /**< index of the variable to be considered */
458 );
459
460 /**
461 * @brief returns size of current (open) partialdec data structure
462 * @return size of current (open) partialdec data structure
463 */
466
467 /**
468 * returns size of finished partialdec data structure
469 * @return size of finished partialdec data structure
470 */
473
474 /**
475 * returns the number of stored partialdecs
476 * @return number of stored partialdecs
477 */
479 int getNPartialdecs();
480
481 /**
482 * @brief returns the number of nonzero entries in the coefficient matrix
483 * @return the number of nonzero entries in the coefficient matrix
484 */
486 int getNNonzeros();
487
488 /**
489 * @brief returns number of different variable partitions
490 * @return number of different variable partitions
491 */
493 int getNVarPartitions();
494
495 /**
496 * @brief return the number of variables considered in the detprobdata
497 * @return the number of variables considered in the detprobdata
498 */
500 int getNVars();
501
502 /**
503 * @brief returns the number of variables for a given constraint
504 * @return the number of variables for a given constraint
505 */
507 int getNVarsForCons(
508 int consIndex /**< index of the constraint to be considered */
509 );
510
511 /**
512 * @brief returns pointers to all orig vars that are fixed to zero
513 * @returns vector of vars
514 */
516 std::vector<SCIP_VAR*> getOrigVarsFixedZero();
517
518 /**
519 * @brief returns pointers to all constraints that are not marked as deleted or obsolete
520 * @returns vector of conss
521 */
523 std::vector<SCIP_CONS*> getRelevantConss();
524
525 /**
526 * @brief returns pointers to all problem vars that are not fixed to 0
527 * @returns vector of vars
528 */
530 std::vector<SCIP_VAR*> getRelevantVars();
531
532 /**
533 * @brief returns the corresponding scip data structure
534 * @return the corresponding scip data structure
535 */
537 SCIP* getScip();
538
539 /**
540 * @brief gets the candidates for number of blocks added by the user followed by the found ones sorted in descending order by how often a candidate was proposed
541 * @param candidates will contain the candidates for number of blocks sorted in descending order by how often a candidate was added
542 */
545 std::vector<int>& candidates
546 );
547
548 /**
549 * @brief returns a coefficient from the coefficient matrix
550 * @return a coefficient from the coefficient matrix
551 */
554 int row, /**< index of the constraint to be considered */
555 int col /**< index of the variable to be considered */
556 );
557
558 /**
559 * @brief returns the nonzero coefficients of the coefficient matrix for a constraint
560 * @return vector of coefficients of in matrix for constraints
561 * @note same order as in @see getVarsForCons()
562 */
564 std::vector<SCIP_Real>& getValsForCons(
565 int consIndex /**< index of the constraint to be considered */
566 );
567
568 /**
569 * @brief returns pointer to a variable partition with given index
570 * @return pointer to a variable partition with given index
571 */
574 int partitionIndex /**< index of variable partition */
575 );
576
577 /**
578 * @brief returns vector to stored variable partitions
579 * @return returns vector to stored variable partitions
580 */
582 std::vector<VarPartition*> getVarPartitions();
583
584 /**
585 * @brief returns SCIP variable related to a variable index
586 * @return SCIP variable pointer related to a variable index
587 */
590 int varIndex /**< index of the variable to be considered */
591 );
592
593 /**
594 * @brief returns the variable indices of the coefficient matrix for a constraint
595 * @return the variable indices of the coefficient matrix for a constraint
596 */
598 std::vector<int>& getVarsForCons(
599 int consIndex /**< index of the constraint to be considered */
600 );
601
602 /**
603 * @brief returns whether a constraint is a cardinality constraint, i.e. of the \f$\sum_{i} x_i = b\f$
604 * @param consindexd index of constraint that is be checked
605 * @return returns whether a constraint is a cardinality constraint
606 */
609 int consindexd
610 );
611
612 /**
613 * @brief determines whether or not the constraint-constraint adjacency data structure is initilized
614 *
615 * @returns true iff the constraint-constraint adjacency data structure is initilized
616 */
619
620 /**
621 * @brief is cons with specified indec partitioning, or packing covering constraint?
622 * @param consindexd index of the given cons
623 * @return is cons with specified indec partitioning, or packing covering constraint
624 */
626 bool isConsSetpp(
627 int consindexd
628 );
629
630 /**
631 * @brief is cons with specified index partitioning packing, or covering constraint?
632 * @param consindexd index of cons to be checked
633 * @return whether a constraint is partitioning packing, or covering constraint?
634 */
636 bool isConsSetppc(
637 int consindexd
638 );
639
640 /** @brief is constraint ranged row, i.e., -inf < lhs < rhs < inf?
641 *
642 * @returns whether val is ranged row
643 */
646 SCIP_Real x /**< value */
647 );
648
649 /**
650 * @brief check if partialdec is a duplicate of an existing finished partialdec
651 * @param partialdec partialdec to be checked
652 * @returns TRUE iff partialdec is a duplicate of an existing finished partialdec
653 */
656 PARTIALDECOMP* partialdec
657 );
658
659 /**
660 * @brief returns true if the matrix structure corresponds to the presolved problem
661 * @return TRUE if the matrix structure corresponds to the presolved problem
662 */
665
666 /** @brief is constraint ranged row, i.e., -inf < lhs < rhs < inf?
667 * @returns whether constraint is ranged row
668 */
671 SCIP_Real lhs, /**< left hand side */
672 SCIP_Real rhs /**< right hand side */
673 );
674
675 /**
676 * @brief check if partialdec is a duplicate of any given partialdecs
677 * @param comppartialdec partialdec to be checked
678 * @param partialdecs partialdecs to compare with
679 * @param sort sort the vars and conss data structures in the partialdecs by their indices
680 * @return TRUE iff partialdec is no duplicate of any given partialdecs
681 */
684 PARTIALDECOMP* comppartialdec,
685 std::vector<PARTIALDECOMP*> const & partialdecs,
686 bool sort
687 );
688
689 /**
690 * @brief output method for json file writer to write block candidate information
691 * @param scip SCIP data structure
692 * @param file output file or NULL for standard output
693 */
696 FILE* file /**< output file or NULL for standard output */
697 );
698
699 /**
700 * @brief output method for json file writer to write partition candidate information
701 * @param file output file or NULL for standard output
702 */
705 FILE* file /**< output file or NULL for standard output */
706 );
707
708 /**
709 * @brief sorts partialdecs in finished partialdecs data structure according to the current scoretype
710 */
713
714 /**
715 * @brief translates partialdecs if the index structure of the problem has changed, e.g. due to presolving
716 * @return translated partialdecs
717 */
719 std::vector<PARTIALDECOMP*> translatePartialdecs(
720 DETPROBDATA* otherdata, /**< old detprobdata */
721 std::vector<PARTIALDECOMP*> otherpartialdecs, /**< partialdecs to be translated */
722 SCIP_Bool translateSymmetry /**< translate symmetry information? */
723 );
724
725 /**
726 * @brief translates partialdecs if the index structure of the problem has changed, e.g. due to presolving
727 * @return translated partialdecs
728 */
730 std::vector<PARTIALDECOMP*> translatePartialdecs(
731 DETPROBDATA* otherdata, /**< old detprobdata */
732 SCIP_Bool translateSymmetry /**< translate symmetry information? */
733 );
734
735
736};
737/* class DETPROBDATA */
738
739
740} /* namespace gcg */
741
742/**
743 * \brief interface data structure for the detector calling methods
744 */
746{
747 gcg::DETPROBDATA* detprobdata; /**< current detprobdata to consider */
748 gcg::PARTIALDECOMP* workonpartialdec; /**< partialdec (aka partial decomposition) to be propagted in next detector call */
749 gcg::PARTIALDECOMP** newpartialdecs; /**< array of new partialdecs to filled by the detetcor methods */
750 int nnewpartialdecs; /**< number of new neeed, set by the detector methods */
751 double detectiontime; /**< time spent on detection */
752};
753
754#endif /* GCG_CLASS_DETPROBDATA_H__ */
SCIP_VAR ** x
class representing a partition of a set of constraints
enum SCIP_Constype_orig SCIP_CONSTYPE_ORIG
SCIP_Constype_orig
@ SCIP_CONSTYPE_GENERAL
@ SCIP_CONSTYPE_SETPARTITION
@ SCIP_CONSTYPE_EMPTY
@ SCIP_CONSTYPE_AGGREGATION
@ SCIP_CONSTYPE_SETPACKING
@ SCIP_CONSTYPE_EQKNAPSACK
@ SCIP_CONSTYPE_BINPACKING
@ SCIP_CONSTYPE_CARDINALITY
@ SCIP_CONSTYPE_INTKNAPSACK
@ SCIP_CONSTYPE_MIXEDBINARY
@ SCIP_CONSTYPE_KNAPSACK
@ SCIP_CONSTYPE_FREE
@ SCIP_CONSTYPE_SETCOVERING
@ SCIP_CONSTYPE_SINGLETON
@ SCIP_CONSTYPE_VARBOUND
@ SCIP_CONSTYPE_INVKNAPSACK
class storing (potentially incomplete) decompositions
class representing a partition of a set of variables
GCG_EXPORT void addPartialdecToAncestor(PARTIALDECOMP *partialdec)
adds a partialdec to ancestor partialdecs
GCG_EXPORT bool addPartialdecToOpen(PARTIALDECOMP *partialdec)
adds a partialdec to current partialdecs (data structure for partialdecs that are goin to processed i...
GCG_EXPORT ConsPartition * getConsPartition(int partitionIndex)
returns pointer to a constraint partition
GCG_EXPORT std::vector< int > & getConssForVar(int varIndex)
returns the constraint indices of the coefficient matrix for a variable
GCG_EXPORT int getIndexForCons(SCIP_CONS *cons)
returns the constraint index related to a SCIP constraint
GCG_EXPORT std::vector< SCIP_Real > & getValsForCons(int consIndex)
returns the nonzero coefficients of the coefficient matrix for a constraint
GCG_EXPORT int getNConssForCons(int consIndex)
returns the number of constraints for a given constraint
GCG_EXPORT int getNConss()
returns the number of variables considered in the detprobdata
GCG_EXPORT SCIP * getScip()
returns the corresponding scip data structure
GCG_EXPORT std::vector< SCIP_VAR * > getOrigVarsFixedZero()
returns pointers to all orig vars that are fixed to zero
GCG_EXPORT int getNVarsForCons(int consIndex)
returns the number of variables for a given constraint
GCG_EXPORT SCIP_Bool isPartialdecDuplicateofFinished(PARTIALDECOMP *partialdec)
check if partialdec is a duplicate of an existing finished partialdec
GCG_EXPORT PARTIALDECOMP * getFinishedPartialdec(int partialdecindex)
returns a partialdec from finished partialdec data structure
GCG_EXPORT int getNNonzeros()
returns the number of nonzero entries in the coefficient matrix
GCG_EXPORT bool isConsCardinalityCons(int consindexd)
returns whether a constraint is a cardinality constraint, i.e. of the
GCG_EXPORT SCIP_Bool isRangedRow(SCIP_Real lhs, SCIP_Real rhs)
is constraint ranged row, i.e., -inf < lhs < rhs < inf?
GCG_EXPORT int getNVars()
return the number of variables considered in the detprobdata
SCIP_Real nblockscandidatescalctime
GCG_EXPORT void freeTemporaryData()
frees temporary data that is only needed during the detection process
GCG_EXPORT bool isConsSetppc(int consindexd)
is cons with specified index partitioning packing, or covering constraint?
GCG_EXPORT void getSortedCandidatesNBlocks(std::vector< int > &candidates)
gets the candidates for number of blocks added by the user followed by the found ones sorted in desce...
GCG_EXPORT int getNConssForVar(int varIndex)
returns the number of constraints for a given variable where the var has a nonzero entry in
GCG_EXPORT std::vector< int > & getConssForCons(int consIndex)
return array of constraint indices that have a common variable with the given constraint
GCG_EXPORT void addVarPartition(VarPartition *partition)
adds a variable partition if it is no duplicate of an existing variable partition
GCG_EXPORT void addPartialdecToFinishedUnchecked(PARTIALDECOMP *partialdec)
adds a partialdec to finished partialdecs without checking for duplicates, dev has to check this on h...
GCG_EXPORT PARTIALDECOMP * getAncestorPartialdec(int partialdecindex)
returns a partialdec from ancestor partialdec data structure with given index
GCG_EXPORT int getNPartialdecs()
GCG_EXPORT SCIP_VAR * getVar(int varIndex)
returns SCIP variable related to a variable index
GCG_EXPORT SCIP_Bool isFiniteNonnegativeIntegral(SCIP_Real x)
is constraint ranged row, i.e., -inf < lhs < rhs < inf?
GCG_EXPORT void printBlockcandidateInformation(FILE *file)
output method for json file writer to write block candidate information
GCG_EXPORT GCG * getGcg()
returns the corresponding gcg data structure
GCG_EXPORT DETPROBDATA(GCG *gcgstruct, SCIP_Bool _originalProblem)
constructor
GCG_EXPORT std::vector< SCIP_CONS * > getRelevantConss()
returns pointers to all constraints that are not marked as deleted or obsolete
GCG_EXPORT VarPartition * getVarPartition(int partitionIndex)
returns pointer to a variable partition with given index
GCG_EXPORT std::vector< PARTIALDECOMP * > & getFinishedPartialdecs()
gets all finished partialdecs
std::vector< std::pair< int, int > > candidatesNBlocks
GCG_EXPORT void createConssAdjacency()
create the constraint adjacency datastructure that is used (if created) for some methods to faster ac...
GCG_EXPORT bool addPartialdecToFinished(PARTIALDECOMP *partialdec)
adds a partialdec to finished partialdecs
GCG_EXPORT void clearAncestorPartialdecs()
clears ancestor partialdec data structure,
GCG_EXPORT SCIP_Bool isConssAdjInitialized()
determines whether or not the constraint-constraint adjacency data structure is initilized
GCG_EXPORT int getNFinishedPartialdecs()
GCG_EXPORT SCIP_Real getVal(int row, int col)
returns a coefficient from the coefficient matrix
GCG_EXPORT int getNOpenPartialdecs()
returns size of current (open) partialdec data structure
GCG_EXPORT int getIndexForVar(SCIP_VAR *var)
returns the variable index related to a SCIP variable
GCG_EXPORT void sortFinishedForScore()
sorts partialdecs in finished partialdecs data structure according to the current scoretype
GCG_EXPORT void printPartitionInformation(FILE *file)
output method for json file writer to write partition candidate information
GCG_EXPORT int getNAncestorPartialdecs()
returns size of ancestor partialdec data structure
GCG_EXPORT std::vector< PARTIALDECOMP * > translatePartialdecs(DETPROBDATA *otherdata, std::vector< PARTIALDECOMP * > otherpartialdecs, SCIP_Bool translateSymmetry)
translates partialdecs if the index structure of the problem has changed, e.g. due to presolving
GCG_EXPORT bool isConsSetpp(int consindexd)
is cons with specified indec partitioning, or packing covering constraint?
GCG_EXPORT std::vector< int > & getVarsForCons(int consIndex)
returns the variable indices of the coefficient matrix for a constraint
GCG_EXPORT void addCandidatesNBlocksNVotes(int candidate, int nvotes)
adds a candidate for block number and counts how often a candidate is added
GCG_EXPORT int getNVarPartitions()
returns number of different variable partitions
GCG_EXPORT int getNConsPartitions()
returns number of different constraint partitions
std::vector< ConsPartition * > conspartitioncollection
std::vector< VarPartition * > varpartitioncollection
GCG_EXPORT void clearFinishedPartialdecs()
clears finished partialdec data structure
GCG_EXPORT void addConsPartition(ConsPartition *partition)
adds a constraint partition if it is no duplicate of an existing constraint partition
GCG_EXPORT std::vector< PARTIALDECOMP * > & getOpenPartialdecs()
determines all partialdecs from current (open) partialdec data structure
GCG_EXPORT std::vector< SCIP_VAR * > getRelevantVars()
returns pointers to all problem vars that are not fixed to 0
GCG_EXPORT SCIP_CONS * getCons(int consIndex)
returns the SCIP constraint related to a constraint index
GCG_EXPORT SCIP_Bool partialdecIsNoDuplicateOfPartialdecs(PARTIALDECOMP *comppartialdec, std::vector< PARTIALDECOMP * > const &partialdecs, bool sort)
check if partialdec is a duplicate of any given partialdecs
GCG_EXPORT std::vector< VarPartition * > getVarPartitions()
returns vector to stored variable partitions
GCG_EXPORT SCIP_Bool isAssignedToOrigProb()
returns true if the matrix structure corresponds to the presolved problem
GCG_EXPORT void clearCurrentPartialdecs()
clears current partialdec data structure
class to manage partial decompositions
#define GCG_EXPORT
Definition def.h:59
#define SCIP_Bool
#define SCIP_Real
GCG interface methods.
SCIP_VAR * var
interface data structure for the detector calling methods
gcg::PARTIALDECOMP ** newpartialdecs
gcg::PARTIALDECOMP * workonpartialdec
gcg::DETPROBDATA * detprobdata
combine two hash function of objects of a pair to get a vaulue for the pair
std::size_t operator()(const std::pair< T1, T2 > &p) const
struct SCIP_Cons SCIP_CONS
struct Gcg GCG
Definition type_gcg.h:44
struct Scip SCIP
struct SCIP_Var SCIP_VAR