diff --git a/include/mp/convert/backend.h b/include/mp/convert/backend.h index 53268b24f..8cd91ef4e 100644 --- a/include/mp/convert/backend.h +++ b/include/mp/convert/backend.h @@ -171,7 +171,7 @@ class BasicBackend : } } - void AddGeneralConstraint(typename Model::AlgebraicCon con) { + void AddGeneralConstraint(typename Model::AlgebraicCon ) { throw MakeUnsupportedError("BasicBackend::AddGeneralConstraint"); } diff --git a/include/mp/convert/constraint_keeper.h b/include/mp/convert/constraint_keeper.h index 0da5eddad..b9ba951cf 100644 --- a/include/mp/convert/constraint_keeper.h +++ b/include/mp/convert/constraint_keeper.h @@ -18,6 +18,7 @@ class BasicConstraintConverter { // Should at least derive bounds & type for the result } void PropagateResult(BasicConstraint& con, double lb, double ub, Context ctx) { + internal::Unused(con, lb, ub, ctx); throw std::logic_error("This should not be called"); } /// By default, we complain about someone trying to convert an unknown constraint diff --git a/include/mp/convert/converter_flat.h b/include/mp/convert/converter_flat.h index e9b1103f5..e65a5420e 100644 --- a/include/mp/convert/converter_flat.h +++ b/include/mp/convert/converter_flat.h @@ -266,7 +266,7 @@ class BasicMPFlatConverter void Exprs2EExprs(const ExprArray& ea, std::array& result) { assert(ea.size() == result.size()); auto itea = ea.begin(); - for (int i=0; i= common_exprs_.size()) + if (index >= (int)common_exprs_.size()) common_exprs_.resize(index+1, -1); // init by -1, "no variable" if (common_exprs_[index]<0) { // not yet converted auto ce = MP_DISPATCH( GetModel() ).common_expr(index); @@ -737,18 +737,21 @@ class BasicMPFlatConverter /// By default, declare mixed context template void PropagateResult(Constraint& con, double lb, double ub, Context ctx) { + internal::Unused(con, lb, ub, ctx); con.SetContext(Context::CTX_MIX); for (const auto a: con.GetArguments()) PropagateResultOfInitExpr(a, this->MinusInfty(), this->Infty(), Context::CTX_MIX); } void PropagateResult(LinearDefiningConstraint& con, double lb, double ub, Context ctx) { + internal::Unused(con, lb, ub, ctx); con.AddContext(ctx); for (const auto& term: con.GetAffineExpr()) PropagateResultOfInitExpr(term.var_index(), this->MinusInfty(), this->Infty(), Context::CTX_MIX); } void PropagateResult(QuadraticDefiningConstraint& con, double lb, double ub, Context ctx) { + internal::Unused(con, lb, ub, ctx); con.AddContext(ctx); const auto& args = con.GetArguments(); for (const auto& term: args.GetAE()) @@ -761,34 +764,40 @@ class BasicMPFlatConverter } void PropagateResult(LinearConstraint& con, double lb, double ub, Context ctx) { + internal::Unused(con, lb, ub, ctx); for (const auto& v: con.vars()) PropagateResultOfInitExpr(v, this->MinusInfty(), this->Infty(), Context::CTX_MIX); } void PropagateResult(IndicatorConstraintLinLE& con, double lb, double ub, Context ctx) { + internal::Unused(con, lb, ub, ctx); for (const auto& v: con.get_lin_vars()) PropagateResultOfInitExpr(v, this->MinusInfty(), this->Infty(), Context::CTX_MIX); } void PropagateResult(NotConstraint& con, double lb, double ub, Context ctx) { + internal::Unused(con, lb, ub, ctx); con.AddContext(ctx); for (const auto a: con.GetArguments()) PropagateResultOfInitExpr(a, 1.0-ub, 1.0-lb, -ctx); } void PropagateResult(ConjunctionConstraint& con, double lb, double ub, Context ctx) { + internal::Unused(con, lb, ub, ctx); con.AddContext(ctx); for (const auto a: con.GetArguments()) PropagateResultOfInitExpr(a, lb, 1.0, +ctx); } void PropagateResult(DisjunctionConstraint& con, double lb, double ub, Context ctx) { + internal::Unused(con, lb, ub, ctx); con.AddContext(ctx); for (const auto a: con.GetArguments()) PropagateResultOfInitExpr(a, 0.0, ub, +ctx); } void PropagateResult(IfThenConstraint& con, double lb, double ub, Context ctx) { + internal::Unused(con, lb, ub, ctx); con.AddContext(ctx); auto& args = con.GetArguments(); PropagateResultOfInitExpr(args[0], 0.0, 1.0, Context::CTX_MIX); @@ -797,15 +806,18 @@ class BasicMPFlatConverter } void PropagateResult(AllDiffConstraint& con, double lb, double ub, Context ctx) { + internal::Unused(con, lb, ub, ctx); con.AddContext(ctx); // TODO go into arguments } void PropagateResult(LE0Constraint& con, double lb, double ub, Context ctx) { + internal::Unused(con, lb, ub, ctx); con.AddContext(ctx); } void PropagateResult(EQ0Constraint& con, double lb, double ub, Context ctx) { + internal::Unused(con, lb, ub, ctx); con.AddContext(ctx); } diff --git a/include/mp/convert/interface_app.h b/include/mp/convert/interface_app.h index e49249938..cba985dfc 100644 --- a/include/mp/convert/interface_app.h +++ b/include/mp/convert/interface_app.h @@ -115,6 +115,8 @@ int InterfaceApp::RunFromNLFile(char **argv, int nl_reader_flags) { template bool InterfaceApp::Init(char **argv, int nl_reader_flags) { + internal::Unused(nl_reader_flags); + // Parse command-line arguments. const char *filename = p_option_parser_->Parse(argv); if (!filename) return false; diff --git a/include/mp/problem.h b/include/mp/problem.h index 35e215d09..1a1dd2f20 100644 --- a/include/mp/problem.h +++ b/include/mp/problem.h @@ -635,7 +635,7 @@ class BasicProblem : public ExprFactory, public SuffixManager { std::size_t new_size = val(SafeInt(vars_.size()) + num_vars); vars_.reserve(new_size); is_var_int_.reserve(new_size); - for (size_t i=0; i!=num_vars; ++i) { + for (int i=0; i!=num_vars; ++i) { vars_.push_back(Var(lb[i], ub[i])); is_var_int_.push_back(type[i] != var::CONTINUOUS); } @@ -1120,7 +1120,7 @@ class BasicProblem : public ExprFactory, public SuffixManager { } template - void PushComplementarityConstraintsTo(Backend& backend) const { + void PushComplementarityConstraintsTo(Backend& ) const { if (HasComplementarity()) { throw std::logic_error("mp::Problem cannot push complementarity to a backend yet."); } diff --git a/include/mp/solver.h b/include/mp/solver.h index f76a98551..8e9dc26e6 100644 --- a/include/mp/solver.h +++ b/include/mp/solver.h @@ -1377,6 +1377,8 @@ int SolverApp::Run(char **argv, int nl_reader_flags) { template bool SolverApp::Init(char **argv, int nl_reader_flags) { + internal::Unused(nl_reader_flags); + // Parse command-line arguments. const char *filename = option_parser_.Parse(argv); if (!filename) return false; diff --git a/test/converter-flat-test.h b/test/converter-flat-test.h index ae169a38f..c22ce9d95 100644 --- a/test/converter-flat-test.h +++ b/test/converter-flat-test.h @@ -68,7 +68,7 @@ mp::IteratedExpr MakeIterated(mp::ExprFactory& ef, mp::expr::Kind kind, const std::vector &args) { const auto N = args.size(); auto builder = ef.BeginIterated(kind, N); - for (int i = 0; i < N; ++i) + for (size_t i = 0; i < N; ++i) builder.AddArg( ef.MakeVariable(args[i]) ); return ef.EndIterated(builder); }