Skip to content

Commit

Permalink
update hiop interface due to the latest changes in hiop
Browse files Browse the repository at this point in the history
  • Loading branch information
nychiang committed Oct 5, 2023
1 parent 2a20d5c commit bfda398
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
12 changes: 6 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,7 @@ 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 +310,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
8 changes: 4 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,13 @@ 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
8 changes: 4 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,7 @@ 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 +349,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
8 changes: 4 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,13 @@ 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

0 comments on commit bfda398

Please sign in to comment.