[sdpb] 87/233: Added maxComplementarity, now output solution for whatever status -- probably shouldn't do this for maxIterations or maxRuntime...

Tobias Hansen thansen at moszumanska.debian.org
Thu Mar 9 04:06:22 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 e45dd08aa06c3bb8343b793c1ea3133e4863c001
Author: David Simmons-Duffin <dsd at athena.sns.ias.edu>
Date:   Sun Oct 5 23:52:57 2014 -0400

    Added maxComplementarity, now output solution for whatever status -- probably shouldn't do this for maxIterations or maxRuntime...
---
 src/SDPSolver.cpp   | 4 ++++
 src/SDPSolver.h     | 3 +++
 src/SDPSolverIO.cpp | 4 ++++
 src/main.cpp        | 7 ++++---
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/SDPSolver.cpp b/src/SDPSolver.cpp
index 56286cd..ba917fb 100644
--- a/src/SDPSolver.cpp
+++ b/src/SDPSolver.cpp
@@ -625,6 +625,10 @@ SDPSolverTerminateReason SDPSolver::run(const SDPSolverParameters &parameters,
     initializeSchurComplementSolver(BilinearPairingsXInv, BilinearPairingsY);
 
     Real mu = frobeniusProductSymmetric(X, Y)/X.dim;
+    if (mu > parameters.maxComplementarity) {
+      finished = MaxComplementarityExceeded;
+      break;
+    }
 
     // Mehrotra predictor solution for (dx, dX, dY)
     Real betaPredictor = predictorCenteringParameter(parameters, isPrimalFeasible && isDualFeasible);
diff --git a/src/SDPSolver.h b/src/SDPSolver.h
index a74893c..fabe09d 100644
--- a/src/SDPSolver.h
+++ b/src/SDPSolver.h
@@ -32,6 +32,7 @@ public:
   Real infeasibleCenteringParameter;
   Real stepLengthReduction;
   Real maxDualObjective;
+  Real maxComplementarity;
 
   void resetPrecision() {
     setPrecision(dualityGapThreshold,          precision);
@@ -43,6 +44,7 @@ public:
     setPrecision(infeasibleCenteringParameter, precision);
     setPrecision(stepLengthReduction,          precision);
     setPrecision(maxDualObjective,             precision);
+    setPrecision(maxComplementarity,           precision);
   }
 
   friend ostream& operator<<(ostream& os, const SDPSolverParameters& p);
@@ -51,6 +53,7 @@ public:
 enum SDPSolverTerminateReason {
   PrimalDualOptimal,
   DualFeasibleMaxObjectiveExceeded,
+  MaxComplementarityExceeded,
   MaxIterationsExceeded,
   MaxRuntimeExceeded,
 };
diff --git a/src/SDPSolverIO.cpp b/src/SDPSolverIO.cpp
index 17a0a0e..8704f41 100644
--- a/src/SDPSolverIO.cpp
+++ b/src/SDPSolverIO.cpp
@@ -56,6 +56,7 @@ ostream& operator<<(ostream& os, const SDPSolverParameters& p) {
   os << "infeasibleCenteringParameter = " << p.infeasibleCenteringParameter << endl;
   os << "stepLengthReduction          = " << p.stepLengthReduction          << endl;
   os << "maxDualObjective             = " << p.maxDualObjective             << endl;
+  os << "maxComplementarity           = " << p.maxComplementarity           << endl;
   return os;
 }
 
@@ -73,6 +74,9 @@ ostream &operator<<(ostream& os, const SDPSolverTerminateReason& r) {
   case DualFeasibleMaxObjectiveExceeded:
     os << "found dual feasible solution with dualObjective exceeding maxDualObjective.";
     break;
+  case MaxComplementarityExceeded:
+    os << "maxComplementarity exceeded.";
+    break;
   }
   return os;
 }
diff --git a/src/main.cpp b/src/main.cpp
index 6271b18..25f4cd7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -56,9 +56,7 @@ int solveSDP(const path &sdpFile,
   cout << endl;
   cout << solver.status << endl;
   cout << timers << endl;
-
-  if (reason == PrimalDualOptimal || reason == DualFeasibleMaxObjectiveExceeded)
-    solver.saveSolution(reason, outFile);
+  solver.saveSolution(reason, outFile);
 
   return 0;
 }
@@ -146,6 +144,9 @@ int main(int argc, char** argv) {
     ("maxDualObjective",
      po::value<Real>(&parameters.maxDualObjective)->default_value(Real("1e10")),
      "Terminate if the dual objective exceeds this value.")
+    ("maxComplementarity",
+     po::value<Real>(&parameters.maxComplementarity)->default_value(Real("1e100")),
+     "Terminate if the complementarity mu = Tr(X Y)/dim(X) exceeds this value.")
     ;
     
   po::options_description cmdLineOptions;

-- 
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