[sdpb] 98/233: Some changes to arguments; added detectDualFeasibleJump flag
Tobias Hansen
thansen at moszumanska.debian.org
Thu Mar 9 04:06:24 UTC 2017
This is an automated email from the git hooks/post-receive script.
thansen pushed a commit to branch master
in repository sdpb.
commit e43d4a881a940c01a4e8b8e930ef556774be8ed4
Author: David Simmons-Duffin <dsd at minerva.sns.ias.edu>
Date: Thu Oct 23 18:30:05 2014 -0400
Some changes to arguments; added detectDualFeasibleJump flag
---
src/SDPSolver.cpp | 20 +++++++++++++++-----
src/SDPSolver.h | 4 +++-
src/SDPSolverIO.cpp | 6 +++++-
src/main.cpp | 20 +++++++++++++-------
4 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/src/SDPSolver.cpp b/src/SDPSolver.cpp
index e1ca9ab..c07da7e 100644
--- a/src/SDPSolver.cpp
+++ b/src/SDPSolver.cpp
@@ -590,7 +590,10 @@ void SDPSolver::initialize(const SDPSolverParameters ¶meters) {
SDPSolverTerminateReason SDPSolver::run(const SDPSolverParameters ¶meters,
const path checkpointFile) {
- for (int iteration = 1; iteration <= parameters.maxIterations; iteration++) {
+ Real primalStepLength;
+ Real dualStepLength;
+
+ for (int iteration = 1;; iteration++) {
if (timers["Save checkpoint"].elapsed().wall >= parameters.checkpointInterval * 1000000000LL)
saveCheckpoint(checkpointFile);
@@ -622,6 +625,12 @@ SDPSolverTerminateReason SDPSolver::run(const SDPSolverParameters ¶meters,
return PrimalDualOptimal;
else if (isDualFeasible && parameters.findDualFeasible)
return DualFeasible;
+ else if (dualStepLength == 1 && parameters.detectDualFeasibleJump)
+ return DualFeasibleJumpDetected;
+ // Detect max iterations after computing errors and objective
+ // functions for the current point
+ else if (iteration > parameters.maxIterations)
+ return MaxIterationsExceeded;
initializeSchurComplementSolver(BilinearPairingsXInv, BilinearPairingsY);
@@ -638,10 +647,10 @@ SDPSolverTerminateReason SDPSolver::run(const SDPSolverParameters ¶meters,
computeSearchDirection(betaCorrector, mu, true);
// Step length to preserve positive definiteness
- Real primalStepLength = stepLength(XCholesky, dX, StepMatrixWorkspace,
- eigenvaluesWorkspace, QRWorkspace, parameters);
- Real dualStepLength = stepLength(YCholesky, dY, StepMatrixWorkspace,
- eigenvaluesWorkspace, QRWorkspace, parameters);
+ primalStepLength = stepLength(XCholesky, dX, StepMatrixWorkspace,
+ eigenvaluesWorkspace, QRWorkspace, parameters);
+ dualStepLength = stepLength(YCholesky, dY, StepMatrixWorkspace,
+ eigenvaluesWorkspace, QRWorkspace, parameters);
if (isPrimalFeasible && isDualFeasible) {
primalStepLength = min(primalStepLength, dualStepLength);
@@ -661,5 +670,6 @@ SDPSolverTerminateReason SDPSolver::run(const SDPSolverParameters ¶meters,
Y += dY;
}
+ // Never reached
return MaxIterationsExceeded;
}
diff --git a/src/SDPSolver.h b/src/SDPSolver.h
index e8d3bd6..67c1b7e 100644
--- a/src/SDPSolver.h
+++ b/src/SDPSolver.h
@@ -21,8 +21,9 @@ public:
int maxIterations;
int maxRuntime;
int checkpointInterval;
- bool saveFinalCheckpoint;
+ bool noFinalCheckpoint;
bool findDualFeasible;
+ bool detectDualFeasibleJump;
int precision;
int maxThreads;
Real dualityGapThreshold;
@@ -53,6 +54,7 @@ public:
enum SDPSolverTerminateReason {
PrimalDualOptimal,
DualFeasible,
+ DualFeasibleJumpDetected,
MaxComplementarityExceeded,
MaxIterationsExceeded,
MaxRuntimeExceeded,
diff --git a/src/SDPSolverIO.cpp b/src/SDPSolverIO.cpp
index e36224c..434845a 100644
--- a/src/SDPSolverIO.cpp
+++ b/src/SDPSolverIO.cpp
@@ -51,8 +51,9 @@ ostream& operator<<(ostream& os, const SDPSolverParameters& p) {
os << "maxIterations = " << p.maxIterations << endl;
os << "maxRuntime = " << p.maxRuntime << endl;
os << "checkpointInterval = " << p.checkpointInterval << endl;
- os << "saveFinalCheckpoint = " << p.saveFinalCheckpoint << endl;
+ os << "noFinalCheckpoint = " << p.noFinalCheckpoint << endl;
os << "findDualFeasible = " << p.findDualFeasible << endl;
+ os << "detectDualFeasibleJump = " << p.detectDualFeasibleJump << endl;
os << "precision(actual) = " << p.precision << "(" << mpf_get_default_prec() << ")" << endl;
os << "maxThreads = " << p.maxThreads << endl;
os << "dualityGapThreshold = " << p.dualityGapThreshold << endl;
@@ -75,6 +76,9 @@ ostream &operator<<(ostream& os, const SDPSolverTerminateReason& r) {
case DualFeasible:
os << "found dual feasible solution";
break;
+ case DualFeasibleJumpDetected:
+ os << "dual feasible jump detected";
+ break;
case MaxIterationsExceeded:
os << "maxIterations exceeded";
break;
diff --git a/src/main.cpp b/src/main.cpp
index 81a8d1d..ad7921e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -65,7 +65,7 @@ int solveSDP(const path &sdpFile,
cout << solver.status << endl;
cout << timers << endl;
- if (parameters.saveFinalCheckpoint)
+ if (!parameters.noFinalCheckpoint)
solver.saveCheckpoint(checkpointFile);
solver.saveSolution(reason, outFile);
@@ -106,20 +106,26 @@ int main(int argc, char** argv) {
solverParamsOptions.add_options()
("precision",
po::value<int>(¶meters.precision)->default_value(400),
- "Precision in binary digits. GMP will typically round up to a nearby "
- "multiple of a power of 2.")
+ "Precision in binary digits. GMP will round up to the nearest "
+ "multiple of 64.")
("maxThreads",
po::value<int>(¶meters.maxThreads)->default_value(4),
"Maximum number of threads to use for parallel calculation.")
("checkpointInterval",
po::value<int>(¶meters.checkpointInterval)->default_value(3600),
"Save checkpoints to checkpointFile every checkpointInterval seconds.")
- ("saveFinalCheckpoint",
- po::value<bool>(¶meters.saveFinalCheckpoint)->default_value(true),
- "Save a final checkpoint after terminating (useful to turn off when debugging).")
+ ("noFinalCheckpoint",
+ po::bool_switch(¶meters.noFinalCheckpoint)->default_value(false),
+ "Don't save a final checkpoint after terminating (useful when debugging).")
("findDualFeasible",
- po::value<bool>(¶meters.findDualFeasible)->default_value(false),
+ po::bool_switch(¶meters.findDualFeasible)->default_value(false),
"Terminate once a dual feasible solution is found.")
+ ("detectDualFeasibleJump",
+ po::bool_switch(¶meters.detectDualFeasibleJump)->default_value(false),
+ "Terminate if a dual-step of 1 is taken. This often indicates that a "
+ "dual feasible solution would be found if the precision were high "
+ "enough. Try increasing either dualErrorThreshold or precision "
+ "and run from the latest checkpoint.")
("maxIterations",
po::value<int>(¶meters.maxIterations)->default_value(500),
"Maximum number of iterations to run the solver.")
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sdpb.git
More information about the debian-science-commits
mailing list