From fa193a3fa4a861a3779161f16899370b01c21576 Mon Sep 17 00:00:00 2001 From: Gleb Belov Date: Mon, 27 Nov 2023 12:43:01 +1100 Subject: [PATCH] Small docu fixes --- include/mp/ampls-cpp-api.h | 3 --- include/mp/backend-base.h | 4 +--- include/mp/backend-std.h | 4 ++-- include/mp/expr.h | 2 +- include/mp/flat/constr_general.h | 2 +- include/mp/flat/constr_keeper.h | 2 +- include/mp/flat/constr_prop_down.h | 4 ++-- include/mp/flat/context.h | 8 ++++---- include/mp/flat/redef/MIP/cond_ineq.h | 4 ++-- include/mp/flat/redef/conic/cones.h | 2 -- include/mp/solver-opt.h | 2 +- include/mp/valcvt-base.h | 4 ++-- nl-writer2/examples/cpp/nlsol_ex.cc | 2 +- nl-writer2/include/mp/nl-writer2.h | 2 +- nl-writer2/include/mp/sol-reader2.hpp | 6 +++--- 15 files changed, 22 insertions(+), 29 deletions(-) diff --git a/include/mp/ampls-cpp-api.h b/include/mp/ampls-cpp-api.h index b246635c8..b1a00052b 100644 --- a/include/mp/ampls-cpp-api.h +++ b/include/mp/ampls-cpp-api.h @@ -19,9 +19,6 @@ extern "C" { /// This function is not for the user. /// /// @param p_be: GurobiBackend etc. -/// @param slv_opt: a string of solver options -/// (normally provided in the _options variable). -/// Can be \a nullptr. /// @return slv on success, otherwise NULL and use AMPLSGetMessages() /// (well they can contain warnings in any case). AMPLS_MP_Solver* AMPLS__internal__Open(std::unique_ptr p_be, diff --git a/include/mp/backend-base.h b/include/mp/backend-base.h index ad6a71971..b13c63d81 100644 --- a/include/mp/backend-base.h +++ b/include/mp/backend-base.h @@ -31,8 +31,6 @@ class BasicBackend : public BasicSolver { } /// Parse solver options such as "outlev=1" from env and argv. - /// @param filename_no_ext: basname of the .nl file - /// (or whatever should be the basename of an output .sol file) /// @param argv: (remaining part of) vector of cmdline strings /// @param flags: 0 or \a Solver::NO_OPTION_ECHO virtual @@ -58,7 +56,7 @@ class BasicBackend : public BasicSolver { /// Read NL. /// This is also used by the AMPLS C API. /// @param opts: 0-terminated list of extra options, - /// to be read after the _options nev var. + /// to be read after the [solver]_options nev var. /// All model-related options should be here /// (obj:.../objno/multiobj, cvt:..., acc:...), /// they are not effective after NL input. diff --git a/include/mp/backend-std.h b/include/mp/backend-std.h index 70b83e47f..8badcae87 100644 --- a/include/mp/backend-std.h +++ b/include/mp/backend-std.h @@ -160,7 +160,7 @@ class StdBackend : * No API to overload, * Impl should check: * - feasrelax() returns feasrelax mode - * - feasrelax(). give the API + * - feasrelax().(methods) give the API **/ DEFINE_STD_FEATURE(FEAS_RELAX) ALLOW_STD_FEATURE(FEAS_RELAX, false) @@ -233,7 +233,7 @@ class StdBackend : /// Read NL. /// @param opts: extra options - /// (to be read after _options env var). + /// (to be read after the [solver]_options env var). /// All model-related options should be here /// (obj:.../objno/multiobj, cvt:..., acc:...). void ReadNL(const std::string& nl_filename, diff --git a/include/mp/expr.h b/include/mp/expr.h index 42681915b..dac510bf5 100644 --- a/include/mp/expr.h +++ b/include/mp/expr.h @@ -686,7 +686,7 @@ class BasicExprFactory : private Alloc { exprs_.push_back(0); typedef typename ExprType::Impl Impl; /// The following cannot overflow. - /// Using ::new due to #174 + /// Using `~new` due to #174 Impl *impl = (Impl*) new char* [sizeof(Impl) + extra_bytes]; impl->kind_ = kind; exprs_.back() = impl; diff --git a/include/mp/flat/constr_general.h b/include/mp/flat/constr_general.h index 5cfde3865..ff59e743a 100644 --- a/include/mp/flat/constr_general.h +++ b/include/mp/flat/constr_general.h @@ -216,7 +216,7 @@ using SOS2Constraint = SOS_1or2_Constraint<2>; //////////////////////////////////////////////////////////////////////// /// Complementarity constraint. -/// complements a variable. +/// \a Expr complements a variable. /// @param Expr: an affine or quadratic functional expression template class ComplementarityConstraint : public BasicConstraint { diff --git a/include/mp/flat/constr_keeper.h b/include/mp/flat/constr_keeper.h index b8163732e..402eea4dc 100644 --- a/include/mp/flat/constr_keeper.h +++ b/include/mp/flat/constr_keeper.h @@ -251,7 +251,7 @@ using VarInfoStatic = VarInfoImpl; /// Solution check data struct SolCheck { /// Construct. - /// @param chkmode: can be subset of 1+2+4+8+16 + /// @param chk_mode: can be subset of 1+2+4+8+16 SolCheck(ArrayRef x, const pre::ValueMapDbl& , //duals, ArrayRef obj, diff --git a/include/mp/flat/constr_prop_down.h b/include/mp/flat/constr_prop_down.h index 66dd7f594..a2c778ae3 100644 --- a/include/mp/flat/constr_prop_down.h +++ b/include/mp/flat/constr_prop_down.h @@ -127,8 +127,8 @@ class ConstraintPropagatorsDown { } /// Context of the condition in IfThen. - /// @args: [condition, then, else] result variables - /// @ctx: context of the overall expression + /// @param args: [condition, then, else] result variables + /// @param ctx: context of the overall expression template void PropagateIfThenResultIntoCondition(Array3 args, Context ctx) { Context ctx_cond = Context::CTX_MIX; diff --git a/include/mp/flat/context.h b/include/mp/flat/context.h index ae6d76e36..c88b84c44 100644 --- a/include/mp/flat/context.h +++ b/include/mp/flat/context.h @@ -5,10 +5,10 @@ namespace mp { /// Expression context /// -/// <-> -/// CTX_POS: expression is implied by the boolean result -/// CTX_NEG: expression's negation is implied by the neg result -/// CTX_MIX: expression is equivalent to the result variable +/// Considering the relation (result) <-> (Expression): +/// - CTX_POS: expression is implied by the boolean result +/// - CTX_NEG: expression's negation is implied by the neg result +/// - CTX_MIX: expression is equivalent to the result variable class Context { public: /// Possible values diff --git a/include/mp/flat/redef/MIP/cond_ineq.h b/include/mp/flat/redef/MIP/cond_ineq.h index 54b3463a5..7649ded8f 100644 --- a/include/mp/flat/redef/MIP/cond_ineq.h +++ b/include/mp/flat/redef/MIP/cond_ineq.h @@ -29,7 +29,7 @@ class Cond_LE_LT_GT_GE_Converter_MIP : static constexpr int kind_input = AlgCon::kind(); /// Convert in positive context: - /// resvar==1 --> (cmp) + /// resvar==1 --> (body) (cmp) (rhs) void ConvertCtxPos(const ItemType& cc, int ) { constexpr auto kind_output = // output comparison is <= or >= ( kind_input>0 ) ? 1 : -1; // even for < or > @@ -44,7 +44,7 @@ class Cond_LE_LT_GT_GE_Converter_MIP : } /// Convert in negative context: - /// resvar==0 --> (body) (!cmp) + /// resvar==0 --> (body) (!cmp) (rhs) void ConvertCtxNeg(const ItemType& cc, int ) { constexpr auto kind_output = // output comparison is <= or >= ( kind_input>0 ) ? -1 : 1; // even for < or > diff --git a/include/mp/flat/redef/conic/cones.h b/include/mp/flat/redef/conic/cones.h index e2228edbc..a1b102f80 100644 --- a/include/mp/flat/redef/conic/cones.h +++ b/include/mp/flat/redef/conic/cones.h @@ -289,7 +289,6 @@ class Convert1QC : public MCKeeper { /// Considering const>=0. /// Accept non-(+-1) coefficients. /// - /// @param body: linear constraint body. /// @param sens: -1 for <=, 1 for >=. /// @param rhs: constraint's rhs. /// @@ -680,7 +679,6 @@ class Convert1ExpC : public MCKeeper { /// /// Accept non-(+-1) coefficients. /// - /// @param body: linear constraint body. /// @param sens: -1 for <=, 1 for >=. /// @param rhs: constraint's rhs. /// diff --git a/include/mp/solver-opt.h b/include/mp/solver-opt.h index 901e4935b..0a41fe44c 100644 --- a/include/mp/solver-opt.h +++ b/include/mp/solver-opt.h @@ -801,7 +801,7 @@ class SolverOptionManager { }; -/// Stored option . +/// Stored option <bool>. /// Can only be set to True. template <> class SolverOptionManager::StoredOption diff --git a/include/mp/valcvt-base.h b/include/mp/valcvt-base.h index 7a2fd378b..f977a39c2 100644 --- a/include/mp/valcvt-base.h +++ b/include/mp/valcvt-base.h @@ -45,9 +45,9 @@ Array CreateArray(Param ) { return Array{}; } /// When IsSingleKey(), the map only has a single array (at key 0), /// accessible via (). /// -/// @param Array: the type of array stored (std::vector / ), +/// @param Array: the type of array stored (std::vector(int) / (double)), /// or ValueNode. -/// @param Param: type of parameter to call CreateArray(Param) +/// @param Param: type of parameter to call CreateArray < Array > (Param) /// when we need to create a mapped value. template class ValueMap { diff --git a/nl-writer2/examples/cpp/nlsol_ex.cc b/nl-writer2/examples/cpp/nlsol_ex.cc index 57320ef51..2fa74ee39 100644 --- a/nl-writer2/examples/cpp/nlsol_ex.cc +++ b/nl-writer2/examples/cpp/nlsol_ex.cc @@ -17,7 +17,7 @@ #include "mp/sol-reader2.hpp" /// Invoke: -/// ipopt ["outlev=1 timelim=500" [text [filestub]]] +/// (this_exe) ipopt ["outlev=1 timelim=500" [text [filestub]]] int main(int argc, const char* const* argv) { if (argc<2) { printf("%s\n", diff --git a/nl-writer2/include/mp/nl-writer2.h b/nl-writer2/include/mp/nl-writer2.h index afe636f2c..4c6035e59 100644 --- a/nl-writer2/include/mp/nl-writer2.h +++ b/nl-writer2/include/mp/nl-writer2.h @@ -213,7 +213,7 @@ class NLWriter2 : SingleSparseVecWrtFactory(NLWriter2& nlw, const char* fmt) : nlw_(nlw), fmt_(fmt) { } /// Construct. More general. - /// @param formatter: a lambda printing something + /// @param hdr_prn: a lambda printing something /// given N nonzeros. SingleSparseVecWrtFactory(NLWriter2& nlw, std::function hdr_prn) diff --git a/nl-writer2/include/mp/sol-reader2.hpp b/nl-writer2/include/mp/sol-reader2.hpp index a53138b8a..f8b743dd7 100644 --- a/nl-writer2/include/mp/sol-reader2.hpp +++ b/nl-writer2/include/mp/sol-reader2.hpp @@ -519,9 +519,9 @@ SOLReadResult SOLReader2::gsufread(FILE* f) { if (sufheadcheck(&SR)) return ReportBadLine(buf); if (!fgets(buf, sizeof(buf)-1, f) - || buf[SR.h.namelen-1] != '\n' - && (buf[SR.h.namelen-1] != '\r' - || buf[SR.h.namelen] != '\n')) + || (buf[SR.h.namelen-1] != '\n' + && (buf[SR.h.namelen-1] != '\r' + || buf[SR.h.namelen] != '\n'))) return ReportBadLine(buf); buf[SR.h.namelen-1] = 0; strcpy(SR.name, buf);