Commit e0302605 authored by Dr.李's avatar Dr.李

update linux libs

parent bcf2a1f1
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#define pfopt_linear_programming_optimizer_hpp #define pfopt_linear_programming_optimizer_hpp
#include "types.hpp" #include "types.hpp"
#include <vector>
#include "ClpSimplex.hpp" #include "ClpSimplex.hpp"
namespace pfopt { namespace pfopt {
...@@ -16,14 +15,16 @@ namespace pfopt { ...@@ -16,14 +15,16 @@ namespace pfopt {
double* upperBound, double* upperBound,
double* objective); double* objective);
std::vector<double> xValue() const { return sol_; } ~LpOptimizer() { delete [] sol_;}
double* xValue() const { return sol_; }
double feval() const; double feval() const;
int status() const { return model_.status(); } int status() const { return model_.status(); }
private: private:
ClpSimplex model_; ClpSimplex model_;
size_t numberOfProb_; size_t numberOfProb_;
std::vector<double> sol_; double* sol_;
}; };
} }
......
...@@ -22,6 +22,8 @@ namespace pfopt { ...@@ -22,6 +22,8 @@ namespace pfopt {
double* varMatrix, double* varMatrix,
double riskAversion=1.); double riskAversion=1.);
virtual ~MeanVariance() { delete [] x_;}
bool setBoundedConstraint(const double* lb, const double* ub); bool setBoundedConstraint(const double* lb, const double* ub);
bool setLinearConstrains(int numCons, const double* consMatrix, const double* clb, const double* cub); bool setLinearConstrains(int numCons, const double* consMatrix, const double* clb, const double* cub);
...@@ -54,7 +56,7 @@ namespace pfopt { ...@@ -54,7 +56,7 @@ namespace pfopt {
IpoptCalculatedQuantities *ip_cq); IpoptCalculatedQuantities *ip_cq);
double feval() const { return feval_; } double feval() const { return feval_; }
std::vector<double> xValue() const { return x_; } double* xValue() const { return x_; }
private: private:
VectorXd expectReturn_; VectorXd expectReturn_;
...@@ -68,7 +70,7 @@ namespace pfopt { ...@@ -68,7 +70,7 @@ namespace pfopt {
const double* ub_; const double* ub_;
VectorXd grad_f_; VectorXd grad_f_;
double feval_; double feval_;
std::vector<double> x_; double* x_;
std::vector<Index> iRow_; std::vector<Index> iRow_;
std::vector<Index> jCol_; std::vector<Index> jCol_;
std::vector<double> g_grad_values_; std::vector<double> g_grad_values_;
......
...@@ -18,7 +18,7 @@ namespace pfopt { ...@@ -18,7 +18,7 @@ namespace pfopt {
double *cub = nullptr, double *cub = nullptr,
double riskAversion = 1.); double riskAversion = 1.);
std::vector<double> xValue() const { return mvImpl_->xValue(); } double* xValue() const { return mvImpl_->xValue(); }
double feval() const { return mvImpl_->feval(); } double feval() const { return mvImpl_->feval(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment