highs-js API reference
    Preparing search index...

    Interface ModelData

    Complete linear, mixed-integer, quadratic, or mixed-integer quadratic model.

    Columns are decision variables x[j]. The bounds mean colLower[j] <= x[j] <= colUpper[j]; rows mean rowLower[i] <= A[i]x <= rowUpper[i]. Use -highs.infinity for a missing lower bound and highs.infinity for a missing upper bound. All axis vectors must have exactly the documented length, dimensions must be non-negative signed 32-bit integers, and matrix dimensions must equal numRows by numCols.

    Omitting integrality makes every column continuous. Supplying it selects variable domains independently of whether hessian supplies a quadratic objective. Every supplied array and string is validated and copied; caller mutation after the call cannot change the native model.

    interface ModelData {
        colCost: NumberInput;
        colLower: NumberInput;
        colNames?: readonly string[];
        colUpper: NumberInput;
        hessian?: HessianInput;
        integrality?: Int32Array<ArrayBufferLike> | readonly VariableType[];
        matrix: SparseMatrixInput;
        modelName?: string;
        numCols: number;
        numRows: number;
        offset?: number;
        rowLower: NumberInput;
        rowNames?: readonly string[];
        rowUpper: NumberInput;
        sense?: ObjectiveSense;
    }
    Index
    colCost: NumberInput

    Linear objective coefficient for each variable, in column order. The linear term is sum(colCost[j] * x[j]), or c'x. The array must contain exactly numCols finite numbers. Use 0 when a variable has no linear objective contribution; infinity is not a substitute for a bound.

    colLower: NumberInput

    Lower bound for each variable: colLower[j] <= x[j]. The array must have exactly numCols entries. Use -highs.infinity for no lower bound. A finite lower bound equal to colUpper[j] fixes the variable; normally each lower bound must not exceed its corresponding upper bound.

    colNames?: readonly string[]

    Optional variable names in exact column order, with exactly numCols strings. Names are copied and later used by name lookup and serialization. Empty, duplicate, or format-invalid names may be rejected by HiGHS.

    colUpper: NumberInput

    Upper bound for each variable: x[j] <= colUpper[j]. The array must have exactly numCols entries. Use highs.infinity for no upper bound. A finite upper bound equal to colLower[j] fixes the variable; normally each upper bound must not be below its corresponding lower bound.

    hessian?: HessianInput

    Optional symmetric matrix Q adding 0.5 * x'Qx to the objective. Its dimension must equal numCols. Omission makes the objective linear; supplying it is independent of integrality, so both may be present. See HessianInput for triangular and square storage rules.

    integrality?: Int32Array<ArrayBufferLike> | readonly VariableType[]

    Domain code for each variable in column order. It must have exactly numCols entries, each one of 0 continuous, 1 integer, 2 semi-continuous, 3 semi-integer, or 4 implicit integer. Prefer named highs.constants.variableType values. Omission makes every variable continuous; it does not remove a supplied quadratic Hessian.

    Sparse coefficient matrix A used by every row activity Ax. Its numRows and numCols must exactly match this model. See SparseMatrixInput for the complete CSC/CSR encoding, offset, index, duplicate, and coefficient rules.

    modelName?: string

    Optional name for the model as a whole. It is metadata used by supported serializers and does not affect optimization. The string is copied.

    numCols: number

    Number of decision variables, also called columns. It must be a non-negative signed 32-bit integer. colCost, colLower, colUpper, and supplied integrality/colNames vectors must have exactly this length; matrix.numCols and a supplied hessian.dimension must equal it.

    numRows: number

    Number of linear constraints, also called rows. It must be a non-negative signed 32-bit integer. rowLower, rowUpper, and supplied rowNames vectors must have exactly this length, and matrix.numRows must equal it.

    offset?: number

    Constant added to the objective independently of all variable values. It changes the reported objective and objective-based stopping criteria but not which x is feasible. Omission means 0.

    rowLower: NumberInput

    Lower bound for each row activity: rowLower[i] <= sum(A[i,j] * x[j]). This is a bound on the computed left-hand side Ax, not a variable value or slack. The array must have exactly numRows entries. Use -highs.infinity when a row has no lower bound.

    rowNames?: readonly string[]

    Optional constraint names in exact row order, with exactly numRows strings. Names are copied and later used by name lookup and serialization; empty, duplicate, or format-invalid names may be rejected.

    rowUpper: NumberInput

    Upper bound for each row activity: sum(A[i,j] * x[j]) <= rowUpper[i]. The array must have exactly numRows entries. Use highs.infinity when a row has no upper bound. Equal finite lower/upper values represent an equality constraint.

    Whether HiGHS minimizes or maximizes the complete objective. Omission means minimize. Use highs.constants.objectiveSense.minimize or .maximize; plain numeric 1/-1 literals are deliberately not accepted by the type. The sense applies to the offset, linear term, and quadratic term together.