Skip to content

Commit

Permalink
AMPLModel: fixed type of error flags
Browse files Browse the repository at this point in the history
  • Loading branch information
cvanaret committed Oct 15, 2024
1 parent 8f7f6d3 commit 9f5b084
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bindings/AMPL/AMPLModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ namespace uno {
}

double AMPLModel::evaluate_objective(const Vector<double>& x) const {
int error_flag = 0;
fint error_flag = 0;
double result = this->objective_sign * (*(this->asl)->p.Objval)(this->asl, 0, const_cast<double*>(x.data()), &error_flag);
if (0 < error_flag) {
throw FunctionEvaluationError();
Expand All @@ -116,7 +116,7 @@ namespace uno {

// sparse gradient
void AMPLModel::evaluate_objective_gradient(const Vector<double>& x, SparseVector<double>& gradient) const {
int error_flag = 0;
fint error_flag = 0;
// prevent ASL to crash by catching all evaluation errors
Jmp_buf err_jmp_uno;
asl->i.err_jmp_ = &err_jmp_uno;
Expand All @@ -143,7 +143,7 @@ namespace uno {

/*
double AMPLModel::evaluate_constraint(int j, const std::vector<double>& x) const {
int error_flag = 0;
fint error_flag = 0;
double result = (*(this->asl)->p.Conival)(this->asl_, j, const_cast<double*>(x.data()), &error_flag);
if (0 < error_flag) {
throw FunctionNumericalError();
Expand All @@ -153,7 +153,7 @@ namespace uno {
*/

void AMPLModel::evaluate_constraints(const Vector<double>& x, std::vector<double>& constraints) const {
int error_flag = 0;
fint error_flag = 0;
(*(this->asl)->p.Conval)(this->asl, const_cast<double*>(x.data()), constraints.data(), &error_flag);
if (0 < error_flag) {
throw FunctionEvaluationError();
Expand All @@ -163,7 +163,7 @@ namespace uno {
// sparse gradient
void AMPLModel::evaluate_constraint_gradient(const Vector<double>& x, size_t constraint_index, SparseVector<double>& gradient) const {
// compute the AMPL sparse gradient
int error_flag = 0;
fint error_flag = 0;
(*(this->asl)->p.Congrd)(this->asl, static_cast<int>(constraint_index), const_cast<double*>(x.data()), const_cast<double*>(this->asl_gradient.data()),
&error_flag);
if (0 < error_flag) {
Expand Down

0 comments on commit 9f5b084

Please sign in to comment.