Skip to content

Commit fabfdec

Browse files
committed
Merge branch 'remove_declared_functions_not_implemented' into 'master'
Remove declared functions not implemented See merge request integer/scip!3818
2 parents 7dbeb8f + 5e0a9f9 commit fabfdec

23 files changed

+193
-350
lines changed

CHANGELOG

+18
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,23 @@ Interface changes
9797
- SCIPapplyBendersDecomposition has been removed. This was originally used to apply Benders' decomposition from a
9898
supplied decomposition structure. The application of Benders' decomposition now occurs in benders_relax.
9999

100+
- remove the following functions that were declared in h-files, but not implemented:
101+
SCIPselectPtrRealReal(), SCIPselectWeightedPtrRealReal(), SCIPsortPtrRealReal(),
102+
SCIPbendersApplyDecomposition(), SCIPcertificatePrintSolExact(),
103+
SCIPcomprInitsol(), SCIPcomprExitsol(),
104+
SCIPincludeExLinconsUpgrade(), SCIPupgradeConsExactLinear(), SCIPgetRunningErrorStatsExactLinear(),
105+
SCIPcolExactGetMinPrimsol(), SCIPgetExprsdataBilinear(),
106+
SCIPreoptnodeGetSplitCons(),
107+
SCIPrationalarrayClear(),
108+
SCIPreoptAddGlbCons(),
109+
SCIPapplyBendersDecomposition,
110+
SCIPgetRowActivityExact(), SCIPgetRowFeasibilityExact()
111+
SCIPgetVarCoefChg()
112+
SCIPvalsExactFree()
113+
SCIPallocateSymgraphConsnodeperm()
114+
SCIPvarGetOrigIndex()
115+
SCIPwriteSto()
116+
100117
### New API functions
101118

102119
- SCIPhistoryUpdateAncPseudocost(), SCIPvarUpdateAncPseudocost() for updating the ancestral pseudo cost fields in variable history
@@ -138,6 +155,7 @@ Interface changes
138155
- added SCIPexprGetIntegrality(), which in addition to the existing function SCIPexprIsIntegral() provides information about the presence of weakly implied integral variables
139156
- added SCIPincludeRelaxBenders(), which is used to include the Benders' decomposition relaxator.
140157
- added SCIPgetMasterProblemRelaxBenders() for retrieving the master problem SCIP instance from the Benders' decomposition relaxator.
158+
- added SCIPsortDownIntIntIntReal()
141159

142160
### Changes in preprocessor macros
143161

+158
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
#!/usr/bin/perl
2+
#
3+
# Parses output of nm on "libscip.a" and searches for functions in a given h-file that are not defined.
4+
#
5+
# To use, first run nm on "libscip.a" and store the output in a
6+
# file. Then run this script on this file with a given h-file.
7+
#
8+
# The code to decect whether we are in a documentation string comes from check_scip_style.prl.
9+
10+
my $narg = @ARGV;
11+
12+
if ( $narg != 2 )
13+
{
14+
printf("usage: <.> <nm-output> <h-file>\n");
15+
exit(1);
16+
}
17+
18+
19+
# open file
20+
open FILE, $ARGV[0] or die $!;
21+
22+
# get list of functions that are defined in the nm-file
23+
my %D;
24+
25+
while(<FILE>)
26+
{
27+
chomp;
28+
my $str = $_;
29+
30+
my @A = split(/\s+/, $str);
31+
if ( $#A > 1 )
32+
{
33+
# the define functions are of type "T" or "t"
34+
if ( $A[1] eq "T" || $A[1] eq "t" )
35+
{
36+
# store the function name in hash
37+
$D{$A[2]} = 1;
38+
}
39+
}
40+
}
41+
close FILE;
42+
43+
# open h-file
44+
open FILE, $ARGV[1] or die $!;
45+
46+
# variables to see whether we are in a comments
47+
my $incomment = 0;
48+
my $indocumentation = 0;
49+
my $afterdocumentation = 0;
50+
51+
printf("Functions that appear in h-file, but are not defined in nm-file:\n");
52+
while(<FILE>)
53+
{
54+
chomp;
55+
my $str = $_;
56+
57+
if ( $str =~ /^#/ )
58+
{
59+
next;
60+
}
61+
62+
# remove everything within a string
63+
if ( $str =~ /\".*\"/ && $str !~ /(extern \"C\" \{)/ )
64+
{
65+
# remove minimal occurence of string
66+
$str =~ s/\".*?\"//g;
67+
}
68+
69+
# if we are in a comment that started in previous lines, we search for the end of the comment
70+
if ( $incomment == 1 || $indocumentation == 1 )
71+
{
72+
$afterdocumentation = 0;
73+
if ( $str =~ /\*\// )
74+
{
75+
# remove comment from current line
76+
$str =~ s/(.*)\*\///g;
77+
78+
if ( $indocumentation == 1 )
79+
{
80+
$afterdocumentation = 1;
81+
}
82+
$incomment = 0;
83+
$indocumentation = 0;
84+
}
85+
else
86+
{
87+
# skip line (comment continues)
88+
next;
89+
}
90+
}
91+
else
92+
{
93+
# if a comment starts or ends in current line
94+
if ( $str =~ /\/\*/ || $str =~ /\*\// )
95+
{
96+
# handle one-line documentation
97+
if ( $str =~ /\/\*\*(.*)\*\// )
98+
{
99+
# remove documentation comments that are within the current line
100+
$str =~ s/\/\*\*(.*)\*\///g;
101+
$afterdocumentation = 1;
102+
}
103+
else
104+
{
105+
# handle one-line comments
106+
if ( $str =~ /\/\*(.*)\*\// )
107+
{
108+
# remove comments that are within the current line
109+
$str =~ s/\/\*(.*)\*\///g;
110+
}
111+
}
112+
113+
# check whether documentation starts
114+
if ( $str =~ /\/\*\*/ )
115+
{
116+
$indocumentation = 1;
117+
$incomment = 1;
118+
$afterdocumentation = 0;
119+
next;
120+
}
121+
122+
# check whether comment starts
123+
if ( $str =~ /\/\*/ )
124+
{
125+
$incomment = 1;
126+
$afterdocumentation = 0;
127+
next;
128+
}
129+
}
130+
}
131+
132+
# try to determine function name
133+
if ( $afterdocumentation == 1 )
134+
{
135+
# check for parenthesis
136+
if ( $str =~ /\S\(/ && $str !~ /\)\)/ )
137+
{
138+
my @mystr = split(/\(/, $str);
139+
my @s = split(/\s+/, $mystr[0]);
140+
141+
# guess function name
142+
my $functionname = $s[$#s];
143+
if ( $mystr[0] =~ /SCIP\_DECL/ )
144+
{
145+
@s = split(/[\s+,\)]/, $mystr[1]);
146+
$functionname = $s[0];
147+
}
148+
149+
$afterdocumentation = 0;
150+
151+
if ( not $D{$functionname} )
152+
{
153+
printf("%s\n", $functionname);
154+
}
155+
}
156+
}
157+
}
158+
close FILE;

src/scip/benders.h

-8
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,6 @@ SCIP_RETCODE SCIPbendersMergeSubproblemIntoMaster(
264264
int probnumber /**< the number of the subproblem that will be merged into the master problem*/
265265
);
266266

267-
/** Applies a Benders' decomposition to the problem based upon the decomposition selected from the storage */
268-
extern
269-
SCIP_RETCODE SCIPbendersApplyDecomposition(
270-
SCIP_BENDERS* benders, /**< Benders' decomposition */
271-
SCIP_SET* set, /**< global SCIP settings */
272-
SCIP_DECOMP* decomp /**< the decomposition to apply to the problem */
273-
);
274-
275267
/** sets priority of Benders' decomposition */
276268
void SCIPbendersSetPriority(
277269
SCIP_BENDERS* benders, /**< Benders' decomposition */

src/scip/certificate.h

-19
Original file line numberDiff line numberDiff line change
@@ -228,18 +228,6 @@ SCIP_RETCODE SCIPcertificatePrintMirCut(
228228
const char sense /**< sense of the constraint, i.e., G, L, or E */
229229
);
230230

231-
/** create a new node data structure for the current node */
232-
SCIP_RETCODE SCIPcertificateTransAggrrow(
233-
SCIP_SET* set, /**< general SCIP settings */
234-
SCIP_PROB* prob, /**< SCIP problem data */
235-
SCIP_CERTIFICATE* certificate, /**< SCIP certificate */
236-
SCIP_AGGRROW* aggrrow, /**< agrrrow that results from the aggregation */
237-
SCIP_ROW* row, /**< the cut that we are attempting to prove */
238-
SCIP_ROW** aggrrows, /**< array of rows used fo the aggregation */
239-
SCIP_Real* weights, /**< array of weights */
240-
int naggrrows /**< length of the arrays */
241-
);
242-
243231
/** prints cutoff bound for objective value **/
244232
SCIP_RETCODE SCIPcertificatePrintCutoffBound(
245233
SCIP* scip, /**< SCIP data structure */
@@ -418,13 +406,6 @@ void SCIPcertificatePrintRtpInfeas(
418406
SCIP_Bool isorigfile /**< should the original solution be printed or in transformed space */
419407
);
420408

421-
/** prints SOL header and exact solution to certificate file */
422-
void SCIPcertificatePrintSolExact(
423-
SCIP_CERTIFICATE* certificate, /**< certificate data structure */
424-
SCIP* scip, /**< SCIP data structure */
425-
SCIP_SOL* sol /**< primal CIP solution */
426-
);
427-
428409
/** updates the current derived bound of the node with newbound, if newbound is better */
429410
SCIP_RETCODE SCIPcertificateUpdateBoundData(
430411
SCIP_CERTIFICATE* certificate, /**< certificate information */

src/scip/compr.h

-12
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,6 @@ SCIP_RETCODE SCIPcomprExit(
9393
SCIP_SET* set /**< global SCIP settings */
9494
);
9595

96-
/** informs tree compression that the branch and bound process is being started */
97-
SCIP_RETCODE SCIPcomprInitsol(
98-
SCIP_COMPR* compr, /**< tree compression */
99-
SCIP_SET* set /**< global SCIP settings */
100-
);
101-
102-
/** informs tree compression that the branch and bound process data is being freed */
103-
SCIP_RETCODE SCIPcomprExitsol(
104-
SCIP_COMPR* compr, /**< tree compression */
105-
SCIP_SET* set /**< global SCIP settings */
106-
);
107-
10896
/** calls execution method of tree compression */
10997
SCIP_RETCODE SCIPcomprExec(
11098
SCIP_COMPR* compr, /**< tree compression */

src/scip/cons_exactlinear.c

+3-35
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ struct SCIP_ConsData
185185
unsigned int removedfixings:1; /**< are all fixed variables removed from the constraint? */
186186
unsigned int changed:1; /**< was constraint changed since last aggregation round in preprocessing? */
187187
unsigned int normalized:1; /**< is the constraint in normalized form? */
188-
unsigned int upgradetried:1; /**< was the constraint already tried to be upgraded? */
189-
unsigned int upgraded:1; /**< is the constraint upgraded and will it be removed after preprocessing? */
190188
unsigned int coefsorted :1; /**< are the constraint's variables sorted? */
191189
unsigned int merged:1; /**< are the constraint's equal variables already merged? */
192190
unsigned int cliquesadded:1; /**< were the cliques of the constraint already extracted? */
@@ -213,16 +211,13 @@ struct SCIP_EventData
213211
struct SCIP_ConshdlrData
214212
{
215213
SCIP_EVENTHDLR* eventhdlr; /**< event handler for bound change events */
216-
SCIP_EXLINCONSUPGRADE** linconsupgrades; /**< linear constraint upgrade methods for specializing linear constraints */
217214
SCIP_RATIONAL* maxaggrnormscale; /**< maximal allowed relative gain in maximum norm for constraint aggregation
218215
* (0.0: disable constraint aggregation) */
219216
SCIP_RATIONAL* maxcardbounddist; /**< maximal relative distance from current node's dual bound to primal bound compared
220217
* to best node's dual bound for separating knapsack cardinality cuts */
221218
SCIP_RATIONAL* mingainpernmincomp; /**< minimal gain per minimal pairwise presolving comparisons to repeat pairwise comparison round */
222219
SCIP_RATIONAL* maxeasyactivitydelta;/**< maximum activity delta to run easy propagation on linear constraint
223220
* (faster, but numerically less stable) */
224-
int linconsupgradessize;/**< size of linconsupgrade array */
225-
int nlinconsupgrades; /**< number of linear constraint upgrade methods */
226221
int tightenboundsfreq; /**< multiplier on propagation frequency, how often the bounds are tightened */
227222
int maxrounds; /**< maximal number of separation rounds per node (-1: unlimited) */
228223
int maxroundsroot; /**< maximal number of separation rounds in the root node (-1: unlimited) */
@@ -370,9 +365,6 @@ SCIP_RETCODE conshdlrdataCreate(
370365
assert(eventhdlr != NULL);
371366

372367
SCIP_CALL( SCIPallocBlockMemory(scip, conshdlrdata) );
373-
(*conshdlrdata)->linconsupgrades = NULL;
374-
(*conshdlrdata)->linconsupgradessize = 0;
375-
(*conshdlrdata)->nlinconsupgrades = 0;
376368
(*conshdlrdata)->naddconss = 0;
377369
(*conshdlrdata)->ncheckserrorbound = 0;
378370
(*conshdlrdata)->nabotserrorbound = 0;
@@ -403,8 +395,6 @@ void conshdlrdataFree(
403395
assert(conshdlrdata != NULL);
404396
assert(*conshdlrdata != NULL);
405397

406-
SCIPfreeBlockMemoryArrayNull(scip, &(*conshdlrdata)->linconsupgrades, (*conshdlrdata)->linconsupgradessize);
407-
408398
SCIPrationalFreeBlock(SCIPblkmem(scip), &(*conshdlrdata)->maxaggrnormscale);
409399
SCIPrationalFreeBlock(SCIPblkmem(scip), &(*conshdlrdata)->maxcardbounddist);
410400
SCIPrationalFreeBlock(SCIPblkmem(scip), &(*conshdlrdata)->maxeasyactivitydelta);
@@ -794,8 +784,6 @@ SCIP_RETCODE consdataCreate(
794784
(*consdata)->removedfixings = FALSE;
795785
(*consdata)->changed = TRUE;
796786
(*consdata)->normalized = FALSE;
797-
(*consdata)->upgradetried = FALSE;
798-
(*consdata)->upgraded = FALSE;
799787
(*consdata)->indexsorted = (nvars <= 1);
800788
(*consdata)->merged = (nvars <= 1);
801789
(*consdata)->cliquesadded = FALSE;
@@ -3289,7 +3277,6 @@ SCIP_RETCODE chgLhs(
32893277
consdata->lhsreal = SCIPrationalRoundReal(lhs, SCIP_R_ROUND_DOWNWARDS);
32903278
consdata->changed = TRUE;
32913279
consdata->normalized = FALSE;
3292-
consdata->upgradetried = FALSE;
32933280
consdata->rangedrowpropagated = 0;
32943281

32953282
/* update the lhs of the LP row */
@@ -3414,7 +3401,6 @@ SCIP_RETCODE chgRhs(
34143401
consdata->rhsreal = SCIPrationalRoundReal(rhs, SCIP_R_ROUND_UPWARDS);
34153402
consdata->changed = TRUE;
34163403
consdata->normalized = FALSE;
3417-
consdata->upgradetried = FALSE;
34183404
consdata->rangedrowpropagated = 0;
34193405

34203406
/* update the rhs of the LP row */
@@ -3509,7 +3495,6 @@ SCIP_RETCODE addCoef(
35093495

35103496
consdata->changed = TRUE;
35113497
consdata->normalized = FALSE;
3512-
consdata->upgradetried = FALSE;
35133498
consdata->cliquesadded = FALSE;
35143499
consdata->implsadded = FALSE;
35153500
consdata->rangedrowpropagated = 0;
@@ -3634,7 +3619,6 @@ SCIP_RETCODE delCoefPos(
36343619
consdata->presolved = FALSE;
36353620
consdata->changed = TRUE;
36363621
consdata->normalized = FALSE;
3637-
consdata->upgradetried = FALSE;
36383622
consdata->cliquesadded = FALSE;
36393623
consdata->implsadded = FALSE;
36403624
consdata->rangedrowpropagated = 0;
@@ -3720,7 +3704,6 @@ SCIP_RETCODE chgCoefPos(
37203704
consdata->presolved = FALSE;
37213705
consdata->changed = TRUE;
37223706
consdata->normalized = FALSE;
3723-
consdata->upgradetried = FALSE;
37243707
consdata->cliquesadded = FALSE;
37253708
consdata->implsadded = FALSE;
37263709
consdata->rangedrowpropagated = 0;
@@ -5300,29 +5283,14 @@ SCIP_DECL_CONSEXITPRE(consExitpreExactLinear)
53005283
assert(scip != NULL);
53015284
assert(SCIPisExact(scip) || nconss == 0);
53025285

5303-
/* delete all linear constraints that were upgraded to a more specific constraint type;
5304-
* make sure, only active variables remain in the remaining constraints
5305-
*/
5286+
/* make sure, only active variables remain in the remaining constraints */
53065287
for( c = 0; c < nconss; ++c )
53075288
{
5308-
SCIP_CONSDATA* consdata;
5309-
53105289
if( SCIPconsIsDeleted(conss[c]) )
53115290
continue;
53125291

5313-
consdata = SCIPconsGetData(conss[c]);
5314-
assert(consdata != NULL);
5315-
5316-
if( consdata->upgraded )
5317-
{
5318-
SCIPerrorMessage("exact linear constraint upgrade not implemented yet\n");
5319-
return SCIP_ERROR;
5320-
}
5321-
else
5322-
{
5323-
/* since we are not allowed to detect infeasibility in the exitpre stage, we dont give an infeasible pointer */
5324-
SCIP_CALL( applyFixings(scip, conss[c], NULL) );
5325-
}
5292+
/* since we are not allowed to detect infeasibility in the exitpre stage, we dont give an infeasible pointer */
5293+
SCIP_CALL( applyFixings(scip, conss[c], NULL) );
53265294
}
53275295

53285296
return SCIP_OKAY;

0 commit comments

Comments
 (0)