Skip to content

Commit

Permalink
Small docu fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
glebbelov committed Nov 27, 2023
1 parent d590fc6 commit fa193a3
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 29 deletions.
3 changes: 0 additions & 3 deletions include/mp/ampls-cpp-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <solver>_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<mp::BasicBackend> p_be,
Expand Down
4 changes: 1 addition & 3 deletions include/mp/backend-base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 <solver>_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.
Expand Down
4 changes: 2 additions & 2 deletions include/mp/backend-std.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class StdBackend :
* No API to overload,
* Impl should check:
* - feasrelax() returns feasrelax mode
* - feasrelax().<methods> give the API
* - feasrelax().(methods) give the API
**/
DEFINE_STD_FEATURE(FEAS_RELAX)
ALLOW_STD_FEATURE(FEAS_RELAX, false)
Expand Down Expand Up @@ -233,7 +233,7 @@ class StdBackend :

/// Read NL.
/// @param opts: extra options
/// (to be read after <solver>_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,
Expand Down
2 changes: 1 addition & 1 deletion include/mp/expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/mp/flat/constr_general.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ using SOS2Constraint = SOS_1or2_Constraint<2>;

////////////////////////////////////////////////////////////////////////
/// Complementarity constraint.
/// <Expr> complements a variable.
/// \a Expr complements a variable.
/// @param Expr: an affine or quadratic functional expression
template <class Expr>
class ComplementarityConstraint : public BasicConstraint {
Expand Down
2 changes: 1 addition & 1 deletion include/mp/flat/constr_keeper.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ using VarInfoStatic = VarInfoImpl<VarVecStatic>;
/// 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<double> x,
const pre::ValueMapDbl& , //duals,
ArrayRef<double> obj,
Expand Down
4 changes: 2 additions & 2 deletions include/mp/flat/constr_prop_down.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <class Array3>
void PropagateIfThenResultIntoCondition(Array3 args, Context ctx) {
Context ctx_cond = Context::CTX_MIX;
Expand Down
8 changes: 4 additions & 4 deletions include/mp/flat/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ namespace mp {

/// Expression context
///
/// <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
/// 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
Expand Down
4 changes: 2 additions & 2 deletions include/mp/flat/redef/MIP/cond_ineq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 --> <body> (cmp) <rhs>
/// 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 >
Expand All @@ -44,7 +44,7 @@ class Cond_LE_LT_GT_GE_Converter_MIP :
}

/// Convert in negative context:
/// resvar==0 --> (body) (!cmp) <rhs>
/// 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 >
Expand Down
2 changes: 0 additions & 2 deletions include/mp/flat/redef/conic/cones.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ class Convert1QC : public MCKeeper<MCType> {
/// Considering const>=0.
/// Accept non-(+-1) coefficients.
///
/// @param body: linear constraint body.
/// @param sens: -1 for <=, 1 for >=.
/// @param rhs: constraint's rhs.
///
Expand Down Expand Up @@ -680,7 +679,6 @@ class Convert1ExpC : public MCKeeper<MCType> {
///
/// Accept non-(+-1) coefficients.
///
/// @param body: linear constraint body.
/// @param sens: -1 for <=, 1 for >=.
/// @param rhs: constraint's rhs.
///
Expand Down
2 changes: 1 addition & 1 deletion include/mp/solver-opt.h
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ class SolverOptionManager {
};


/// Stored option <bool>.
/// Stored option &lt;bool&gt;.
/// Can only be set to True.
template <>
class SolverOptionManager::StoredOption<bool>
Expand Down
4 changes: 2 additions & 2 deletions include/mp/valcvt-base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> / <double>),
/// @param Array: the type of array stored (std::vector(int) / (double)),
/// or ValueNode.
/// @param Param: type of parameter to call CreateArray<Array>(Param)
/// @param Param: type of parameter to call CreateArray &lt; Array &gt; (Param)
/// when we need to create a mapped value.
template <class Array, class Param=int>
class ValueMap {
Expand Down
2 changes: 1 addition & 1 deletion nl-writer2/examples/cpp/nlsol_ex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "mp/sol-reader2.hpp"

/// Invoke:
/// <this_exe> 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",
Expand Down
2 changes: 1 addition & 1 deletion nl-writer2/include/mp/nl-writer2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<void(int)> hdr_prn)
Expand Down
6 changes: 3 additions & 3 deletions nl-writer2/include/mp/sol-reader2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,9 @@ SOLReadResult SOLReader2<SOLHandler2>::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);
Expand Down

0 comments on commit fa193a3

Please sign in to comment.