Skip to content

Commit 36e2cc6

Browse files
committed
remove cmake flag and fclose file
2 parents 1f00774 + 1a345db commit 36e2cc6

File tree

7 files changed

+80
-95
lines changed

7 files changed

+80
-95
lines changed

CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,6 @@ else()
172172
set(CUDA_LIBRARY-NOTFOUND true)
173173
endif()
174174

175-
# option to force native termination, mostly for testing new GPU code
176-
# in comparison with the CPU
177-
option(CUPDLP_FORCE_NATIVE "Build pdlp with native termination" OFF)
178-
179175
if (BUILD_CXX)
180176
# Default Build Type to be Release
181177
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)

check/CMakeLists.txt

Lines changed: 45 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -278,62 +278,56 @@ if ((NOT FAST_BUILD OR ALL_TESTS) AND NOT (BUILD_EXTRA_UNIT_ONLY))
278278
)
279279

280280
if (UNIX AND NOT APPLE AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
281-
if (CUPDLP_CPU AND NOT CUPDLP_FORCE_NATIVE)
281+
if (CUPDLP_GPU)
282282
set(pdlpInstances
283-
"25fv47\; 5.50184588\;"
284-
"adlittle\; 2.254949631\;"
285-
"afiro\;-4.64753142\;"
286-
"avgas\;-7.749999999\;"
283+
"25fv47\; 5.5018549\;"
284+
"adlittle\; 2.254950\;"
285+
"afiro\;-4.6475325\;"
286+
"avgas\;-7.75000038\;"
287287
"blending\;-3.19999999\;"
288-
"chip\;-9.000000001\;"
289-
"e226\;-1.16389293\;"
290-
"scrs8\; 9.042969511\;"
291-
"sctest\; 5.749999936\;"
292-
"shell\; 1.2088253460\;"
293-
"stair\;-2.51266951\;"
294-
"standata\; 1.257699499\;"
295-
"standgub\; 1.25769949\;"
288+
"chip\;-9.0000000\;"
289+
"e226\;-1.16389258\;"
290+
"scrs8\; 9.0429623\;"
291+
"sctest\; 5.750000001\;"
292+
"shell\; 1.20882535\;"
293+
"stair\;-2.5126695\;"
294+
"standata\; 1.25769951\;"
295+
"standgub\; 1.2576993\;"
296+
)
297+
else() # CUPDLP_CPU
298+
set(pdlpInstances
299+
"25fv47\; 5.5018360\;"
300+
"adlittle\; 2.254953\;"
301+
"afiro\;-4.64753126\;"
302+
"avgas\;-7.75000038\;"
303+
"blending\;-3.19999999\;"
304+
"chip\;-9.000000020\;"
305+
"e226\;-1.163892070\;"
306+
"scrs8\; 9.042970154\;"
307+
"sctest\; 5.750000001\;"
308+
"shell\; 1.2088253471\;"
309+
"stair\;-2.512669020\;"
310+
"standata\; 1.257699155\;"
311+
"standgub\; 1.257700132\;"
296312
)
297-
else()
298-
if (CUPDLP_GPU)
299-
set(pdlpInstances
300-
"25fv47\; 5.5018549\;"
301-
"adlittle\; 2.254950\;"
302-
"afiro\;-4.6475325\;"
303-
"avgas\;-7.75000038\;"
304-
"blending\;-3.19999999\;"
305-
"chip\;-9.0000000\;"
306-
"e226\;-1.16389258\;"
307-
"scrs8\; 9.0429623\;"
308-
"sctest\; 5.750000001\;"
309-
"shell\; 1.20882535\;"
310-
"stair\;-2.5126695\;"
311-
"standata\; 1.25769951\;"
312-
"standgub\; 1.2576993\;"
313-
)
314-
else()
315-
# CUPDLP_GPU or CPU with native termination.
316-
if (CUPDLP_FORCE_NATIVE)
317-
set(pdlpInstances
318-
"25fv47\; 5.5018360\;"
319-
"adlittle\; 2.254953\;"
320-
"afiro\;-4.64753126\;"
321-
"avgas\;-7.75000038\;"
322-
"blending\;-3.19999999\;"
323-
"chip\;-9.000000020\;"
324-
"e226\;-1.163892070\;"
325-
"scrs8\; 9.042970154\;"
326-
"sctest\; 5.750000001\;"
327-
"shell\; 1.2088253471\;"
328-
"stair\;-2.512669020\;"
329-
"standata\; 1.257699155\;"
330-
"standgub\; 1.257700132\;"
331-
)
332-
endif()
333-
endif()
334313
endif()
335314
elseif(WIN32 AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
336-
if (CUPDLP_CPU AND NOT CUPDLP_FORCE_NATIVE)
315+
if (CUPDLP_GPU)
316+
set(pdlpInstances
317+
"25fv47\; 5.50185\;" # 549 release 500 debug
318+
"adlittle\; 2.2549505\;"
319+
"afiro\;-4.6475325\;"
320+
"avgas\;-7.750000\;"
321+
"blending\;-3.19999999\;"
322+
"chip\;-9.0000000\;"
323+
"scrs8\; 9.0429693\;"
324+
"sctest\; 5.7500000\;"
325+
"shell\; 1.20882535\;"
326+
"stair\;-2.512669\;" # 96 release 95 debug
327+
"standata\; 1.2576995\;"
328+
"standgub\; 1.2576993\;"
329+
)
330+
else() # CUPDLP_CPU
337331
# on windows e226 model status is unknown
338332
# on windows 25fv47 model status can be unknown, with objective 5.5018458957e+03
339333
set(pdlpInstances
@@ -350,23 +344,6 @@ if ((NOT FAST_BUILD OR ALL_TESTS) AND NOT (BUILD_EXTRA_UNIT_ONLY))
350344
"standata\; 1.2576995\;"
351345
"standgub\; 1.2576995\;"
352346
)
353-
else()
354-
if (CUPDLP_GPU)
355-
set(pdlpInstances
356-
"25fv47\; 5.50185\;" # 549 release 500 debug
357-
"adlittle\; 2.2549505\;"
358-
"afiro\;-4.6475325\;"
359-
"avgas\;-7.750000\;"
360-
"blending\;-3.19999999\;"
361-
"chip\;-9.0000000\;"
362-
"scrs8\; 9.0429693\;"
363-
"sctest\; 5.7500000\;"
364-
"shell\; 1.20882535\;"
365-
"stair\;-2.512669\;" # 96 release 95 debug
366-
"standata\; 1.2576995\;"
367-
"standgub\; 1.2576993\;"
368-
)
369-
endif()
370347
endif()
371348
elseif(APPLE)
372349
set(pdlpInstances

highs/HConfig.h.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#cmakedefine ZLIB_FOUND
66
#cmakedefine CUPDLP_CPU
77
#cmakedefine CUPDLP_GPU
8-
#cmakedefine CUPDLP_FORCE_NATIVE
98
#cmakedefine CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@"
109
#cmakedefine CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
1110
#cmakedefine HIGHSINT64

highs/lp_data/HighsInterface.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3746,8 +3746,9 @@ bool Highs::infeasibleBoundsOk() {
37463746
if (perform_inward_integer_rounding &&
37473747
lp.integrality_[iCol] == HighsVarType::kInteger) {
37483748
// Assess bounds after inward integer rounding
3749-
double integer_lower = std::ceil(lower);
3750-
double integer_upper = std::floor(upper);
3749+
double feastol = this->options_.mip_feasibility_tolerance;
3750+
double integer_lower = std::ceil(lower - feastol);
3751+
double integer_upper = std::floor(upper + feastol);
37513752
assert(integer_lower >= lower);
37523753
assert(integer_upper <= upper);
37533754
performed_inward_integer_rounding =

highs/mip/HighsFeasibilityJump.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ HighsModelStatus HighsMipSolverData::feasibilityJump() {
2828
double objective_function_value;
2929

3030
// Configure Feasibility Jump and pass it the problem
31-
external_feasibilityjump::equalityTolerance = epsilon;
32-
external_feasibilityjump::violationTolerance = feastol;
33-
3431
int verbosity = mipsolver.submip ? 0 : mipsolver.options_mip_->log_dev_level;
3532
auto solver = external_feasibilityjump::FeasibilityJumpSolver(
36-
/* seed = */ 0, /* verbosity = */ verbosity);
33+
/* seed = */ 0, /* verbosity = */ verbosity,
34+
/* equalityTolerance = */ epsilon,
35+
/* violationTolerance = */ feastol);
3736

3837
for (HighsInt col = 0; col < model->num_col_; ++col) {
3938
double lower = model->col_lower_[col];
@@ -47,8 +46,8 @@ HighsModelStatus HighsMipSolverData::feasibilityJump() {
4746
fjVarType = external_feasibilityjump::VarType::Continuous;
4847
} else {
4948
fjVarType = external_feasibilityjump::VarType::Integer;
50-
lower = std::ceil(lower);
51-
upper = std::floor(upper);
49+
lower = std::ceil(lower - feastol);
50+
upper = std::floor(upper + feastol);
5251
}
5352

5453
const bool legal_bounds = lower <= upper && lower < kHighsInf &&

highs/mip/HighsMipSolver.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,9 @@ void HighsMipSolver::cleanupSolve() {
852852
if (!timeless_log) analysis_.reportMipTimer();
853853

854854
assert(modelstatus_ != HighsModelStatus::kNotset);
855+
856+
if (improving_solution_file_ != nullptr)
857+
fclose(improving_solution_file_);
855858
}
856859

857860
// Only called in Highs::runPresolve

highs/mip/feasibilityjump.hh

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,8 @@ struct FJStatus {
3333
double* solution;
3434
};
3535

36-
double violationTolerance = 1.0e-5;
37-
double equalityTolerance = 1.0e-5;
38-
39-
// Measures if two doubles are equal within a tolerance of 1.0e-5.
40-
bool eq(double a, double b) { return fabs(a - b) < equalityTolerance; }
36+
// Measures if two doubles are equal within a tolerance
37+
bool eq(double a, double b, double tol) { return fabs(a - b) < tol; }
4138

4239
struct IdxCoeff {
4340
uint32_t idx;
@@ -102,7 +99,14 @@ struct LhsModification {
10299
// Stores the MIP problem, an incumbent assignment, and the set of constraints
103100
// that are violated in the current incumbent assignment. This set is maintained
104101
// when changes are given to the incumbent assignment using `setValue`.
105-
struct Problem {
102+
class Problem {
103+
const double equalityTolerance;
104+
const double violationTolerance;
105+
106+
public:
107+
Problem(double equalityTolerance, double violationTolerance)
108+
: equalityTolerance(equalityTolerance),
109+
violationTolerance(violationTolerance) {}
106110
std::vector<Var> vars;
107111
std::vector<Constraint> constraints;
108112
std::vector<double> incumbentAssignment;
@@ -168,7 +172,7 @@ struct Problem {
168172
else if (sense == RowType::Gte)
169173
ok = 0 + equalityTolerance >= rhs;
170174
else
171-
ok = eq(0, rhs);
175+
ok = eq(0, rhs, equalityTolerance);
172176

173177
return ok ? INT_MAX : INT_MIN;
174178
}
@@ -297,10 +301,12 @@ void modifyMove(LhsModification mod, Problem& problem, Move& move) {
297301
// Stores current moves and computes updated jump values for
298302
// the "Jump" move type.
299303
class JumpMove {
304+
const double equalityTolerance;
300305
std::vector<Move> moves;
301306
std::vector<std::pair<double, double>> bestShiftBuffer;
302307

303308
public:
309+
JumpMove(double equalityTolerance) : equalityTolerance(equalityTolerance) {}
304310
void init(Problem& problem) { moves.resize(problem.vars.size()); }
305311

306312
template <typename F>
@@ -396,16 +402,19 @@ class JumpMove {
396402
// %g\n", currentScore,currentSlope, currentValue, bestScore, bestValue
397403
// );
398404

399-
if (eq(bestValue, varIncumbentValue) ||
400-
(!eq(currentValue, varIncumbentValue) && currentScore < bestScore)) {
405+
if (eq(bestValue, varIncumbentValue, equalityTolerance) ||
406+
(!eq(currentValue, varIncumbentValue, equalityTolerance) &&
407+
currentScore < bestScore)) {
401408
bestScore = currentScore;
402409
bestValue = currentValue;
403410
}
404411

405412
// Slope is always increasing, so if we have a valid value, we can quit
406413
// as soon as the slope turns nonnegative, since we must already have
407414
// visited the minimum.
408-
if (!eq(bestValue, varIncumbentValue) && currentSlope >= 0.) break;
415+
if (!eq(bestValue, varIncumbentValue, equalityTolerance) &&
416+
currentSlope >= 0.)
417+
break;
409418
}
410419

411420
// printf("Setting jump for %d to from %g to %g\n", varIdx,
@@ -458,7 +467,11 @@ class FeasibilityJumpSolver {
458467

459468
public:
460469
FeasibilityJumpSolver(int seed = 0, int _verbosity = 0,
461-
double _weightUpdateDecay = 1.0) {
470+
double _weightUpdateDecay = 1.0,
471+
double equalityTolerance = 1e-5,
472+
double violationTolerance = 1e-5)
473+
: problem(equalityTolerance, violationTolerance),
474+
jumpMove(equalityTolerance) {
462475
verbosity = _verbosity;
463476
weightUpdateDecay = _weightUpdateDecay;
464477
rng = std::mt19937(seed);
@@ -572,10 +585,7 @@ class FeasibilityJumpSolver {
572585
for (size_t i = 0; i < sampleSize; i++) {
573586
auto setidx = rng() % goodVarsSet.size();
574587
auto varIdx = goodVarsSet[setidx];
575-
// assert(goodVarsSetIdx[varIdx] >= 0 && goodVarsSetIdx[varIdx] ==
576-
// setidx);
577588
Move move = bestMove(varIdx);
578-
// assert(move.score > equalityTolerance);
579589
if (move.score > bestScore) {
580590
bestScore = move.score;
581591
bestVar = varIdx;

0 commit comments

Comments
 (0)