pattern data for Ringpacking Problem
This file implements the handling of patterns. Each pattern has a SCIP_PATTERNTYPE
, accessible by SCIPpatternGetPatternType()
, which indicates whether it is a circular or rectangular pattern.
Definition in file pattern.c.
Go to the source code of this file.
|
static |
ensures that there is enough memory to store elements
pattern | pattern |
size | required size |
Definition at line 45 of file pattern.c.
References assert(), SCIP_Pattern::blkmem, BMSreallocBlockMemoryArray, MAX, NULL, SCIP_ALLOC, SCIP_OKAY, SCIP_Pattern::size, SCIP_Pattern::types, SCIP_Pattern::xs, and SCIP_Pattern::ys.
Referenced by SCIPpatternAddElement(), and SCIPpatternCopy().
|
static |
auxiliary function to create a pattern
scip | SCIP data structure |
pattern | pointer to store pattern |
patterntype | pattern type |
type | circle type (not needed for rectangular patterns) |
Definition at line 68 of file pattern.c.
References assert(), BMSclearMemory, NULL, SCIP_CALL, SCIP_OKAY, SCIP_PACKABLE_UNKNOWN, SCIPallocBlockMemory, SCIPblkmem(), and SCIPpatternCapture().
Referenced by SCIPpatternCopy(), SCIPpatternCreateCircular(), and SCIPpatternCreateRectangular().
SCIP_RETCODE SCIPpatternCreateCircular | ( | SCIP * | scip, |
SCIP_PATTERN ** | pattern, | ||
int | type ) |
creates an empty circular pattern
scip | SCIP data structure |
pattern | pointer to store pattern |
type | circle type (not needed for rectangular patterns) |
Definition at line 97 of file pattern.c.
References createPattern(), and SCIP_PATTERNTYPE_CIRCULAR.
Referenced by SCIPprobdataEnumeratePatterns().
SCIP_RETCODE SCIPpatternCreateRectangular | ( | SCIP * | scip, |
SCIP_PATTERN ** | pattern ) |
creates an empty rectangular pattern
scip | SCIP data structure |
pattern | pointer to store pattern |
Definition at line 107 of file pattern.c.
References createPattern(), and SCIP_PATTERNTYPE_RECTANGULAR.
Referenced by addVariable(), and setupProblem().
void SCIPpatternCapture | ( | SCIP_PATTERN * | pattern | ) |
captures a pattern
pattern | pattern |
Definition at line 116 of file pattern.c.
References assert(), SCIP_Pattern::nlocks, and NULL.
Referenced by createPattern(), and probdataCreate().
void SCIPpatternRelease | ( | SCIP * | scip, |
SCIP_PATTERN ** | pattern ) |
scip | SCIP data structure |
pattern | pointer to free pattern |
Definition at line 126 of file pattern.c.
References assert(), NULL, SCIPfreeBlockMemory, and SCIPfreeBlockMemoryArrayNull.
Referenced by addVariable(), filterPatterns(), probdataFree(), SCIPprobdataEnumeratePatterns(), and setupProblem().
SCIP_RETCODE SCIPpatternCopy | ( | SCIP * | scip, |
SCIP_PATTERN * | pattern, | ||
SCIP_PATTERN ** | copy ) |
copies a pattern
scip | SCIP data structure |
pattern | pattern to copy |
copy | pointer to store the copy |
Definition at line 152 of file pattern.c.
References assert(), createPattern(), ensureElemSize(), i, SCIP_Pattern::nelems, NULL, SCIP_Pattern::packable, SCIP_Pattern::patterntype, SCIP_CALL, SCIP_OKAY, SCIPpatternAddElement(), SCIP_Pattern::type, SCIP_Pattern::types, SCIP_Pattern::xs, and SCIP_Pattern::ys.
Referenced by SCIPprobdataAddVar().
SCIP_RETCODE SCIPpatternAddElement | ( | SCIP_PATTERN * | pattern, |
int | type, | ||
SCIP_Real | x, | ||
SCIP_Real | y ) |
adds an element of a given type to a pattern; packable status does not change
pattern | pattern |
type | element of a given type |
x | x-coordinate (SCIP_INVALID: unknown) |
y | y-coordinate (SCIP_INVALID: unknown) |
Definition at line 182 of file pattern.c.
References assert(), ensureElemSize(), SCIP_Pattern::nelems, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_Pattern::types, x, SCIP_Pattern::xs, y, and SCIP_Pattern::ys.
Referenced by addVariable(), enumeratePatterns(), SCIPpatternCopy(), and setupProblem().
void SCIPpatternRemoveLastElements | ( | SCIP_PATTERN * | pattern, |
int | k ) |
removes the last k elements
pattern | pattern |
k | number of elements to remove |
Definition at line 203 of file pattern.c.
References assert(), SCIP_Pattern::nelems, and NULL.
Referenced by enumeratePatterns().
int SCIPpatternGetNElemens | ( | SCIP_PATTERN * | pattern | ) |
returns the total number of elements
pattern | pattern |
Definition at line 215 of file pattern.c.
References assert(), SCIP_Pattern::nelems, and NULL.
Referenced by createPatternVars(), enumeratePatterns(), isPatternDominating(), SCIP_DECL_EVENTEXEC(), SCIPcheckPattern(), SCIPverifyCircularPatternHeuristic(), and SCIPverifyCircularPatternNLP().
int SCIPpatternGetElementType | ( | SCIP_PATTERN * | pattern, |
int | i ) |
returns the type of the i-th element
pattern | pattern |
i | index |
Definition at line 225 of file pattern.c.
References assert(), i, NULL, and SCIP_Pattern::types.
Referenced by createPatternVars(), enumeratePatterns(), isPatternDominating(), SCIP_DECL_EVENTEXEC(), SCIPcheckPattern(), SCIPverifyCircularPatternHeuristic(), and SCIPverifyCircularPatternNLP().
int SCIPpatternCountElements | ( | SCIP_PATTERN * | pattern, |
int | type ) |
returns the total number of elements of a given type
pattern | pattern |
type | type |
Definition at line 237 of file pattern.c.
References assert(), i, SCIP_Pattern::nelems, NULL, and SCIP_Pattern::types.
Referenced by setupProblem().
SCIP_Real SCIPpatternGetElementPosX | ( | SCIP_PATTERN * | pattern, |
int | elem ) |
returns the x-coordinate of an element
pattern | pattern |
elem | index of the element |
Definition at line 257 of file pattern.c.
References assert(), NULL, SCIP_Real, and SCIP_Pattern::xs.
Referenced by SCIP_DECL_EVENTEXEC(), and SCIPcheckPattern().
SCIP_Real SCIPpatternGetElementPosY | ( | SCIP_PATTERN * | pattern, |
int | elem ) |
returns the y-coordinate of an element
pattern | pattern |
elem | index of the element |
Definition at line 269 of file pattern.c.
References assert(), NULL, SCIP_Real, and SCIP_Pattern::ys.
Referenced by SCIP_DECL_EVENTEXEC(), and SCIPcheckPattern().
void SCIPpatternSetElementPos | ( | SCIP_PATTERN * | pattern, |
int | elem, | ||
SCIP_Real | x, | ||
SCIP_Real | y ) |
sets the (x,y) position of an element
pattern | pattern |
elem | index of the element |
x | x-coordinate |
y | y-coordinate |
Definition at line 281 of file pattern.c.
References assert(), NULL, SCIP_Real, x, SCIP_Pattern::xs, y, and SCIP_Pattern::ys.
Referenced by SCIPverifyCircularPatternHeuristic(), and SCIPverifyCircularPatternNLP().
SCIP_PATTERNTYPE SCIPpatternGetPatternType | ( | SCIP_PATTERN * | pattern | ) |
returns the type of a pattern
pattern | pattern |
Definition at line 296 of file pattern.c.
References assert(), NULL, and SCIP_Pattern::patterntype.
Referenced by SCIPcheckPattern(), SCIPprobdataAddVar(), SCIPverifyCircularPatternHeuristic(), SCIPverifyCircularPatternNLP(), setupProblem(), and verifyCircularPattern().
int SCIPpatternGetCircleType | ( | SCIP_PATTERN * | pattern | ) |
returns the type of the boundary circle
pattern | pattern |
Definition at line 309 of file pattern.c.
References assert(), NULL, SCIP_Pattern::patterntype, SCIP_PATTERNTYPE_CIRCULAR, and SCIP_Pattern::type.
Referenced by createPatternVars(), enumeratePatterns(), isPatternDominating(), SCIP_DECL_EVENTEXEC(), SCIPcheckPattern(), SCIPverifyCircularPatternHeuristic(), SCIPverifyCircularPatternNLP(), and setupProblem().
void SCIPpatternSetType | ( | SCIP_PATTERN * | pattern, |
int | type ) |
sets the type of the boundary circle
pattern | pattern |
type | type |
Definition at line 323 of file pattern.c.
References assert(), NULL, SCIP_Pattern::patterntype, SCIP_PATTERNTYPE_CIRCULAR, and SCIP_Pattern::type.
Referenced by SCIPprobdataEnumeratePatterns().
SCIP_PACKABLE SCIPpatternGetPackableStatus | ( | SCIP_PATTERN * | pattern | ) |
returns the packable status of a pattern
pattern | pattern |
Definition at line 335 of file pattern.c.
References assert(), NULL, and SCIP_Pattern::packable.
Referenced by enforceSol(), enumeratePatterns(), getNCPatterns(), isPatternDominating(), isSolFeasible(), SCIP_DECL_CONSLOCK(), SCIP_DECL_EVENTEXEC(), SCIPcheckPattern(), SCIPprobdataAddVar(), SCIPverifyCircularPatternHeuristic(), SCIPverifyCircularPatternNLP(), and verifyCircularPattern().
void SCIPpatternSetPackableStatus | ( | SCIP_PATTERN * | pattern, |
SCIP_PACKABLE | packable ) |
sets the packable status of a pattern
pattern | pattern |
packable | packable status |
Definition at line 345 of file pattern.c.
References assert(), NULL, and SCIP_Pattern::packable.
Referenced by addVariable(), enumeratePatterns(), SCIPverifyCircularPatternHeuristic(), SCIPverifyCircularPatternNLP(), and setupProblem().