@@ -34,11 +34,19 @@ class AugLagrangian
3434{
3535 public:
3636 /* *
37- * Initialize the Augmented Lagrangian with the default L-BFGS optimizer. We
38- * limit the number of L-BFGS iterations to 1000, rather than the unlimited
39- * default L-BFGS.
37+ * Initialize the Augmented Lagrangian with the default L-BFGS optimizer.
38+ * @param penaltyThresholdFactor When the penalty threshold is updated set
39+ * the penalty threshold to the penalty multplied by this factor. The
40+ * default value of 0.25 is is taken from Burer and Monteiro (2002).
41+ * @param sigmaUpdateFactor When sigma is updated multiply sigma by this
42+ * value. The default value of 10 is taken from Burer and Monteiro (2002).
43+ * @param maxIterations Maximum number of iterations of the Augmented
44+ * Lagrangian algorithm. 0 indicates no maximum.
4045 */
41- AugLagrangian ();
46+ AugLagrangian (const size_t maxIterations = 1000 ,
47+ const double penaltyThresholdFactor = 0.25 ,
48+ const double sigmaUpdateFactor = 10.0 ,
49+ const L_BFGS& lbfgs = L_BFGS());
4250
4351 /* *
4452 * Optimize the function. The value '1' is used for the initial value of each
@@ -49,13 +57,10 @@ class AugLagrangian
4957 * class.
5058 * @param function The function to optimize.
5159 * @param coordinates Output matrix to store the optimized coordinates in.
52- * @param maxIterations Maximum number of iterations of the Augmented
53- * Lagrangian algorithm. 0 indicates no maximum.
5460 */
5561 template <typename LagrangianFunctionType>
5662 bool Optimize (LagrangianFunctionType& function,
57- arma::mat& coordinates,
58- const size_t maxIterations = 1000 );
63+ arma::mat& coordinates);
5964
6065 /* *
6166 * Optimize the function, giving initial estimates for the Lagrange
@@ -69,15 +74,12 @@ class AugLagrangian
6974 * @param initLambda Vector of initial Lagrange multipliers. Should have
7075 * length equal to the number of constraints.
7176 * @param initSigma Initial penalty parameter.
72- * @param maxIterations Maximum number of iterations of the Augmented
73- * Lagrangian algorithm. 0 indicates no maximum.
7477 */
7578 template <typename LagrangianFunctionType>
7679 bool Optimize (LagrangianFunctionType& function,
7780 arma::mat& coordinates,
7881 const arma::vec& initLambda,
79- const double initSigma,
80- const size_t maxIterations = 1000 );
82+ const double initSigma);
8183
8284 // ! Get the L-BFGS object used for the actual optimization.
8385 const L_BFGS& LBFGS () const { return lbfgs; }
@@ -94,12 +96,33 @@ class AugLagrangian
9496 // ! Modify the penalty parameter.
9597 double & Sigma () { return sigma; }
9698
99+ // ! Get the maximum iterations
100+ size_t MaxIterations () const { return maxIterations; }
101+ // ! Modify the maximum iterations
102+ size_t & MaxIterations () { return maxIterations; }
103+
104+ // ! Get the penalty threshold updating parameter
105+ double PenaltyThresholdFactor () const { return penaltyThresholdFactor; }
106+ // ! Modify the penalty threshold updating parameter
107+ double & PenaltyThresholdFactor () { return penaltyThresholdFactor; }
108+
109+ // ! Get the sigma update factor
110+ double SigmaUpdateFactor () const { return sigmaUpdateFactor; }
111+ // ! Modify the sigma update factor
112+ double & SigmaUpdateFactor () { return sigmaUpdateFactor; }
113+
97114 private:
98- // ! If the user did not pass an L_BFGS object, we'll use our own internal one.
99- L_BFGS lbfgsInternal;
115+ // ! Maximum number of iterations.
116+ size_t maxIterations;
117+
118+ // ! Parameter for updating the penalty threshold
119+ double penaltyThresholdFactor;
120+
121+ // ! Parameter for updating sigma
122+ double sigmaUpdateFactor;
100123
101124 // ! The L-BFGS optimizer that we will use.
102- L_BFGS& lbfgs;
125+ L_BFGS lbfgs;
103126
104127 // ! Lagrange multipliers.
105128 arma::vec lambda;
@@ -112,8 +135,7 @@ class AugLagrangian
112135 */
113136 template <typename LagrangianFunctionType>
114137 bool Optimize (AugLagrangianFunction<LagrangianFunctionType>& augfunc,
115- arma::mat& coordinates,
116- const size_t maxIterations);
138+ arma::mat& coordinates);
117139};
118140
119141} // namespace ens
0 commit comments