/** * @file src/model.ts * @description Model class for LP/MIP problem representation * * Provides the programmatic API for building optimization problems: * - Add variables with costs and integer constraints * - Define constraints (<=, >=, =) with coefficients * - Load problems from JSON model definitions * - Dynamic model modification after initialization * * The Model converts high-level problem definitions into the internal * Tableau representation used by the simplex algorithm. */ import Tableau from "./tableau/tableau"; import { Constraint, Equality, IntegerVariable, Variable } from "./expressions"; import type { Priority } from "./expressions"; import type { BranchAndCutService } from "./tableau/branch-and-cut"; import type { Model as JsonModel } from "./types/solver"; import type { TableauSolution, TableauSolutionSet } from "./tableau"; import { type PresolveResult } from "./tableau/presolve"; declare class Model { tableau: Tableau; name?: string; variables: Variable[]; integerVariables: IntegerVariable[]; unrestrictedVariables: Record; constraints: Constraint[]; nConstraints: number; nVariables: number; isMinimization: boolean; tableauInitialized: boolean; relaxationIndex: number; useMIRCuts: boolean; checkForCycles: boolean; messages: unknown[]; tolerance?: number; timeout?: number; keep_solutions?: boolean; solutions?: TableauSolutionSet[]; availableIndexes: number[]; lastElementIndex: number; usePresolve: boolean; presolveResult: PresolveResult | null; constructor(precision?: number, name?: string, branchAndCutService?: BranchAndCutService); minimize(): this; maximize(): this; _getNewElementIndex(): number; _addConstraint(constraint: Constraint): void; smallerThan(rhs: number): Constraint; greaterThan(rhs: number): Constraint; equal(rhs: number): Equality; addVariable(cost?: number | null, id?: string | null, isInteger?: boolean, isUnrestricted?: boolean, priority?: Priority | null): Variable; _removeConstraint(constraint: Constraint): void; removeConstraint(constraint: Constraint | Equality): this; removeVariable(variable: Variable): this | void; updateRightHandSide(constraint: Constraint, difference: number): this; updateConstraintCoefficient(constraint: Constraint, variable: Variable, difference: number): this; setCost(cost: number, variable: Variable): this; loadJson(jsonModel: JsonModel): this; getNumberOfIntegerVariables(): number; solve(): TableauSolution; /** * Apply presolve reductions to the model. * Sets fixed variable values and removes redundant constraints. */ private applyPresolveReductions; isFeasible(): boolean; save(): void; restore(): void; activateMIRCuts(useMIRCuts: boolean): void; debug(debugCheckForCycles: boolean): void; log(message: unknown): Tableau; } export default Model;