Model Construction Interface
Three building modes:
- Row-by-row: addRow(indices, values, lb, ub)
- Column-by-column: addCol(indices, values, lb, ub, obj)
- Element-by-element: setElement(row, col, value)
Name handling: hash tables for row/column name lookup Expression parsing: "2 x1 + 3 x2 <= 5" string syntax
Complexity
Insertion: O(1) amortized with dynamic arrays Name lookup: O(1) expected with hash tables Conversion to CoinPackedMatrix: O(nnz)
Implementations
CoinUtils
- CoinModel.hpp - High-level model building with string names and expressions
CoinModel provides a flexible interface for constructing LP/MIP models. Supports row/column names, string-based expressions, and incremental building. Convert to CoinPackedMatrix for solver use.