Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Just a basic idea. LRSDP would need to be refactored, and probably AugLagrangian too.
- class SDP<typename ObjectiveMatrixType>
- {
- public:
- // This would be an API modification; I think it could work...
- double Evaluate(const arma::mat& coordinates);
- double EvaluateConstraint(const arma::mat& coordinates, const size_t i);
- void Gradient(const arma::mat& coordinates, arma::mat& gradient);
- void GradientConstraint(const arma::mat& coordinates, arma::mat& gradient);
- private:
- ObjectiveMatrixType c;
- std::vector<arma::sp_mat> sparseA;
- arma::vec sparseB;
- std::vector<arma::mat> denseA;
- arma::vec denseB;
- };
- template<typename ObjectiveMatrixType>
- class LinearConstraintSDP : public SDP<ObjectiveMatrixType>
- {
- public:
- // We need new evaluate functions...
- double Evaluate(const arma::mat& coordinates);
- double EvaluateConstraint(const arma::mat& coordinates, const size_t i);
- void Gradient(const arma::mat& coordinates, arma::mat& gradient);
- void GradientConstraint(const arma::mat& coordinates, arma::mat& gradient);
- private:
- // In addition to what the parent class holds, we need to hold linear constraints too.
- std::vector<LinearConstraint> linearA;
- arma::vec linearB;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement