SCIP-SDP  2.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
SdpVarfixer.c File Reference

adds the main functionality to fix/unfix/(multi-)aggregate variables by merging two three-tuple-arrays of row/col/val together More...

Go to the source code of this file.

Functions

void SCIPsdpVarfixerSortRowCol (int *row, int *col, SCIP_Real *val, int length)
 
SCIP_RETCODE SCIPsdpVarfixerMergeArrays (BMS_BLKMEM *blkmem, SCIP_Real feastol, int *originrow, int *origincol, SCIP_Real *originval, int originlength, SCIP_Bool originsorted, SCIP_Real scalar, int *targetrow, int *targetcol, SCIP_Real *targetval, int *targetlength, int targetmemory)
 
SCIP_RETCODE SCIPsdpVarfixerMergeArraysIntoNew (BMS_BLKMEM *blkmem, SCIP_Real feastol, int *firstrow, int *firstcol, SCIP_Real *firstval, int firstlength, int *secondrow, int *secondcol, SCIP_Real *secondval, int secondlength, int *targetrow, int *targetcol, SCIP_Real *targetval, int *targetlength)
 

Detailed Description

adds the main functionality to fix/unfix/(multi-)aggregate variables by merging two three-tuple-arrays of row/col/val together

Author
Tristan Gally

Definition in file SdpVarfixer.c.

Function Documentation

void SCIPsdpVarfixerSortRowCol ( int *  row,
int *  col,
SCIP_Real *  val,
int  length 
)

sort the given row, col and val arrays first by non-decreasing row-indices, then for those with identical row-indices by non-decreasing col-indices

Parameters
rowrow indices
colcolumn indices
valvalues
lengthlength of the given arrays

Definition at line 50 of file SdpVarfixer.c.

Referenced by multiaggrVar(), SCIPsdpVarfixerMergeArrays(), and SCIPsdpVarfixerMergeArraysIntoNew().

SCIP_RETCODE SCIPsdpVarfixerMergeArrays ( BMS_BLKMEM *  blkmem,
SCIP_Real  feastol,
int *  originrow,
int *  origincol,
SCIP_Real *  originval,
int  originlength,
SCIP_Bool  originsorted,
SCIP_Real  scalar,
int *  targetrow,
int *  targetcol,
SCIP_Real *  targetval,
int *  targetlength,
int  targetmemory 
)

merges two three-tuple-arrays together

The original arrays (which may have multiple entries for the same row and col) will be mulitplied with scalar and then merged into the target arrays (which may not have multiple entries for the same row and col). If there is already an entry for a row/col combination, these two entries will be combined (their values added together), if they cancel each other out the nonzero entry will be removed. If you think of the matrices described by the two arrays, this is a matrix addition (but only working on the nonzeros for efficiency). The target arrays need to be long enough, otherwise targetlength returns the needed amount and a corresponding debug message is thrown.

Parameters
blkmemblock memory
feastolonly values bigger than this are counted as nonzeros
originroworiginal row-index-array that is going to be merged, may be NULL if originlength = 0
origincoloriginal column-index-array that is going to be merged, may be NULL if originlength = 0
originvaloriginal nonzero-values-array that is going to be merged, may be NULL if originlength = 0
originlengthlength of the original arrays
originsortedare the origin arrays already sorted by non-decreasing row and in case of ties col
scalarscalar that the original nonzero-values will be multiplied with before merging
targetrowrow-index-array the original array will be merged into
targetcolcolumn-index-array the original array will be merged into
targetvalnonzero-values-array the original array will be merged into
targetlengthlength of the target arrays the original arrays will be merged into, this will be updated to the new length after the mergings
targetmemoryamount of memory allocated for targetrow, -col, -val, if this isn't sufficient targetlength will return the needed amount and a corresponding debug message will be thrown

Definition at line 88 of file SdpVarfixer.c.

References SCIPsdpVarfixerSortRowCol().

Referenced by fixAndAggrVars(), and multiaggrVar().

SCIP_RETCODE SCIPsdpVarfixerMergeArraysIntoNew ( BMS_BLKMEM *  blkmem,
SCIP_Real  feastol,
int *  firstrow,
int *  firstcol,
SCIP_Real *  firstval,
int  firstlength,
int *  secondrow,
int *  secondcol,
SCIP_Real *  secondval,
int  secondlength,
int *  targetrow,
int *  targetcol,
SCIP_Real *  targetval,
int *  targetlength 
)

merges two three-tuple-arrays together

If there are multiple entries for a row/col combination, these will be combined (their values added together), if they cancel each other out the nonzero entry will be removed. The first arrays are assumed to have unique row/col-combinations, the second arrays may have duplicates of the same row/col-combination. In constrast to MergeArrays, here the combined arrays will be inserted in the new targetarrays, and not overwrite one of the old arrays. targetlength should give the length of the target arrays, if this is not sufficient, the needed length is returned there and a debug message is thrown.

Parameters
blkmemblock memory
feastolonly values bigger than this are counted as nonzeros
firstrowfirst row-index-array that is going to be merged, may be NULL if firstlength = 0
firstcolfirst column-index-array that is going to be merged, may be NULL if firstlength = 0
firstvalfirst nonzero-values-array that is going to be merged, may be NULL if firstlength = 0
firstlengthlength of the first arrays
secondrowsecond row-index-array that is going to be merged, may be NULL if secondlength = 0
secondcolsecond column-index-array that is going to be merged, may be NULL if secondlength = 0
secondvalsecond nonzero-values-array that is going to be merged, may be NULL if secondlength = 0
secondlengthlength of the second arrays
targetrowrow-index-array the original arrays will be merged into
targetcolcolumn-index-array the original arrays will be merged into
targetvalnonzero-values-array the original arrays will be merged into
targetlengthlength of the target arrays the original arrays will be merged into, this will be updated to the new length after the mergings

Definition at line 255 of file SdpVarfixer.c.

References SCIPsdpVarfixerSortRowCol().

Referenced by compConstMatAfterFixings().