Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update hiop interface due to the latest changes in hiop #30

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/scopflow/solver/hiop/scopflow_hiop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ extern PetscErrorCode SCOPFLOWUpdateOPFLOWVariableBounds(OPFLOW, Vec, Vec,
/* Note: x only holds the coupled variables which, in this case, are the
generator real power variables for the base-case
*/
bool SCOPFLOWHIOPInterface::eval_f_rterm(size_t idx, const int &n,
bool SCOPFLOWHIOPInterface::eval_f_rterm(hiop::size_type idx, const int &n,
const double *x, double &rval) {
PetscErrorCode ierr;
OPFLOW opflow0; /* base case OPFLOW */
Expand Down Expand Up @@ -245,7 +245,8 @@ bool SCOPFLOWHIOPInterface::eval_f_rterm(size_t idx, const int &n,
return true;
}

bool SCOPFLOWHIOPInterface::eval_grad_rterm(size_t idx, const int &n, double *x,
bool SCOPFLOWHIOPInterface::eval_grad_rterm(hiop::size_type idx, const int &n,
double *x,
hiop::hiopVector &gradvec) {
(void)idx;
(void)n;
Expand Down Expand Up @@ -310,12 +311,12 @@ bool SCOPFLOWHIOPInterface::eval_grad_rterm(size_t idx, const int &n, double *x,
return true;
}

size_t SCOPFLOWHIOPInterface::get_num_rterms() const {
return scopflow->Nc - 1;
hiop::size_type SCOPFLOWHIOPInterface::get_num_rterms() const {
return (hiop::size_type)scopflow->Nc - 1;
}

size_t SCOPFLOWHIOPInterface::get_num_vars() const {
return scopflow->opflow0->nx;
hiop::size_type SCOPFLOWHIOPInterface::get_num_vars() const {
return (hiop::size_type)scopflow->opflow0->nx;
}

void SCOPFLOWHIOPInterface::get_solution(double *x) const {
Expand Down
9 changes: 5 additions & 4 deletions src/scopflow/solver/hiop/scopflow_hiop.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ class SCOPFLOWHIOPInterface : public hiop::hiopInterfacePriDecProblem {
const double *hess,
const char *master_options_file);

bool eval_f_rterm(size_t idx, const int &n, const double *x, double &rval);
bool eval_grad_rterm(size_t idx, const int &n, double *x,
bool eval_f_rterm(hiop::size_type idx, const int &n, const double *x,
double &rval);
bool eval_grad_rterm(hiop::size_type idx, const int &n, double *x,
hiop::hiopVector &grad);

size_t get_num_rterms() const;
hiop::size_type get_num_rterms() const;

size_t get_num_vars() const;
hiop::size_type get_num_vars() const;

void get_solution(double *x) const;

Expand Down
9 changes: 5 additions & 4 deletions src/sopflow/solver/hiop/sopflow_hiop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ extern PetscErrorCode SOPFLOWUpdateOPFLOWVariableBounds(OPFLOW, Vec, Vec,
/* Note: x only holds the coupled variables which, in this case, are the
generator real power variables for the base-case
*/
bool SOPFLOWHIOPInterface::eval_f_rterm(size_t idx, const int &n,
bool SOPFLOWHIOPInterface::eval_f_rterm(hiop::size_type idx, const int &n,
const double *x, double &rval) {
(void)n;
PetscErrorCode ierr;
Expand Down Expand Up @@ -283,7 +283,8 @@ bool SOPFLOWHIOPInterface::eval_f_rterm(size_t idx, const int &n,
return true;
}

bool SOPFLOWHIOPInterface::eval_grad_rterm(size_t idx, const int &n, double *x,
bool SOPFLOWHIOPInterface::eval_grad_rterm(hiop::size_type idx, const int &n,
double *x,
hiop::hiopVector &gradvec) {
(void)idx;
(void)n;
Expand Down Expand Up @@ -349,11 +350,11 @@ bool SOPFLOWHIOPInterface::eval_grad_rterm(size_t idx, const int &n, double *x,
return true;
}

size_t SOPFLOWHIOPInterface::get_num_rterms() const {
hiop::size_type SOPFLOWHIOPInterface::get_num_rterms() const {
return (sopflow->Ns * sopflow->Nc) - 1;
}

size_t SOPFLOWHIOPInterface::get_num_vars() const {
hiop::size_type SOPFLOWHIOPInterface::get_num_vars() const {
return sopflow->opflow0->nx;
}

Expand Down
9 changes: 5 additions & 4 deletions src/sopflow/solver/hiop/sopflow_hiop.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ class SOPFLOWHIOPInterface : public hiop::hiopInterfacePriDecProblem {
const double *hess,
const char *master_options_file);

bool eval_f_rterm(size_t idx, const int &n, const double *x, double &rval);
bool eval_grad_rterm(size_t idx, const int &n, double *x,
bool eval_f_rterm(hiop::size_type idx, const int &n, const double *x,
double &rval);
bool eval_grad_rterm(hiop::size_type idx, const int &n, double *x,
hiop::hiopVector &grad);

size_t get_num_rterms() const;
hiop::size_type get_num_rterms() const;

size_t get_num_vars() const;
hiop::size_type get_num_vars() const;

void get_solution(double *x) const;

Expand Down
Loading