highs-js API reference
    Preparing search index...

    Type Alias LegacyHighs

    Compatibility API for solving one model at a time.

    The asynchronous loader creates this object, but solve() itself is synchronous: JavaScript execution is blocked until HiGHS finishes or reaches a configured limit. Each call creates a fresh native solver, so models, options, solutions, clocks, and basis state are never shared between calls.

    type LegacyHighs = {
        solve(
            problem: string,
            options?: Readonly<
                Partial<
                    {
                        dual_feasibility_tolerance: number;
                        glpsol_cost_row_location: GlpsolCostRowLocation
                        | number;
                        highs_analysis_level: HighsAnalysisLevel;
                        highs_debug_level: HighsDebugLevel;
                        icrash: boolean;
                        icrash_approx_iter: number;
                        icrash_breakpoints: boolean;
                        icrash_dualize: boolean;
                        icrash_exact: boolean;
                        icrash_iterations: number;
                        icrash_starting_weight: number;
                        icrash_strategy: string;
                        iis_strategy: IisStrategy;
                        infinite_bound: number;
                        infinite_cost: number;
                        ipm_iteration_limit: number;
                        ipm_optimality_tolerance: number;
                        large_matrix_value: number;
                        log_file: string;
                        log_to_console: boolean;
                        mip_abs_gap: number;
                        mip_allow_restart: boolean;
                        mip_detect_symmetry: boolean;
                        mip_feasibility_tolerance: number;
                        mip_heuristic_effort: number;
                        mip_improving_solution_file: string;
                        mip_improving_solution_report_sparse: boolean;
                        mip_improving_solution_save: boolean;
                        mip_lp_age_limit: number;
                        mip_max_improving_sols: number;
                        mip_max_leaves: number;
                        mip_max_nodes: number;
                        mip_max_stall_nodes: number;
                        mip_max_start_nodes: number;
                        mip_min_cliquetable_entries_for_parallelism: number;
                        mip_min_logging_interval: number;
                        mip_pool_age_limit: number;
                        mip_pool_soft_limit: number;
                        mip_pscost_minreliable: number;
                        mip_rel_gap: number;
                        mip_report_level: number;
                        objective_bound: number;
                        objective_target: number;
                        output_flag: boolean;
                        parallel: "off" | "choose" | "on";
                        pdlp_cupdlpc_restart_method: number;
                        pdlp_iteration_limit: number;
                        pdlp_optimality_tolerance: number;
                        pdlp_restart_strategy: number;
                        pdlp_scaling_mode: number;
                        presolve: "off" | "choose" | "on";
                        primal_feasibility_tolerance: number;
                        qp_iteration_limit: number;
                        qp_nullspace_limit: number;
                        random_seed: number;
                        ranging: "off" | "on";
                        run_crossover: "off" | "choose" | "on";
                        simplex_crash_strategy: SimplexCrashStrategy;
                        simplex_dual_edge_weight_strategy: SimplexEdgeWeightStrategy;
                        simplex_iteration_limit: number;
                        simplex_max_concurrency: number;
                        simplex_min_concurrency: number;
                        simplex_primal_edge_weight_strategy: SimplexEdgeWeightStrategy;
                        simplex_scale_strategy: SimplexScaleStrategy;
                        simplex_strategy: SimplexStrategy;
                        simplex_update_limit: number;
                        small_matrix_value: number;
                        solution_file: string;
                        solver:
                            | "choose"
                            | "simplex"
                            | "ipm"
                            | "ipx"
                            | "hipo"
                            | "pdlp"
                            | "qpasm"
                            | "hipdlp";
                        threads: number;
                        time_limit: number;
                        user_bound_scale: number;
                        user_cost_scale: number;
                        write_model_file: string;
                        write_model_to_file: boolean;
                        write_presolved_model_file: string;
                        write_presolved_model_to_file: boolean;
                        write_solution_style: SolutionStyle;
                        write_solution_to_file: boolean;
                    },
                >,
            >,
        ): HighsSolution;
    }
    Index
    • Parses problem as a CPLEX LP-format model, solves it, and returns detached JavaScript objects containing the available result.

      problem is model text, not a path. options are applied to a fresh native instance before solving; omitted options use the defaults compiled into HiGHS. The call blocks the current JavaScript thread. A native read, option-setting, run, or solution-extraction error throws. Unknown options, wrong value types, and integer option values that are non-integral or do not fit a signed 32-bit integer also throw. In contrast, an optimization outcome such as infeasible, unbounded, or time-limited is returned in HighsSolution.Status and is not a JavaScript exception.

      All returned objects and arrays are copies. Mutating them cannot affect HiGHS, and the native instance is destroyed before this method returns.

      Parameters

      • problem: string
      • Optionaloptions: Readonly<
            Partial<
                {
                    dual_feasibility_tolerance: number;
                    glpsol_cost_row_location: GlpsolCostRowLocation
                    | number;
                    highs_analysis_level: HighsAnalysisLevel;
                    highs_debug_level: HighsDebugLevel;
                    icrash: boolean;
                    icrash_approx_iter: number;
                    icrash_breakpoints: boolean;
                    icrash_dualize: boolean;
                    icrash_exact: boolean;
                    icrash_iterations: number;
                    icrash_starting_weight: number;
                    icrash_strategy: string;
                    iis_strategy: IisStrategy;
                    infinite_bound: number;
                    infinite_cost: number;
                    ipm_iteration_limit: number;
                    ipm_optimality_tolerance: number;
                    large_matrix_value: number;
                    log_file: string;
                    log_to_console: boolean;
                    mip_abs_gap: number;
                    mip_allow_restart: boolean;
                    mip_detect_symmetry: boolean;
                    mip_feasibility_tolerance: number;
                    mip_heuristic_effort: number;
                    mip_improving_solution_file: string;
                    mip_improving_solution_report_sparse: boolean;
                    mip_improving_solution_save: boolean;
                    mip_lp_age_limit: number;
                    mip_max_improving_sols: number;
                    mip_max_leaves: number;
                    mip_max_nodes: number;
                    mip_max_stall_nodes: number;
                    mip_max_start_nodes: number;
                    mip_min_cliquetable_entries_for_parallelism: number;
                    mip_min_logging_interval: number;
                    mip_pool_age_limit: number;
                    mip_pool_soft_limit: number;
                    mip_pscost_minreliable: number;
                    mip_rel_gap: number;
                    mip_report_level: number;
                    objective_bound: number;
                    objective_target: number;
                    output_flag: boolean;
                    parallel: "off" | "choose" | "on";
                    pdlp_cupdlpc_restart_method: number;
                    pdlp_iteration_limit: number;
                    pdlp_optimality_tolerance: number;
                    pdlp_restart_strategy: number;
                    pdlp_scaling_mode: number;
                    presolve: "off" | "choose" | "on";
                    primal_feasibility_tolerance: number;
                    qp_iteration_limit: number;
                    qp_nullspace_limit: number;
                    random_seed: number;
                    ranging: "off" | "on";
                    run_crossover: "off" | "choose" | "on";
                    simplex_crash_strategy: SimplexCrashStrategy;
                    simplex_dual_edge_weight_strategy: SimplexEdgeWeightStrategy;
                    simplex_iteration_limit: number;
                    simplex_max_concurrency: number;
                    simplex_min_concurrency: number;
                    simplex_primal_edge_weight_strategy: SimplexEdgeWeightStrategy;
                    simplex_scale_strategy: SimplexScaleStrategy;
                    simplex_strategy: SimplexStrategy;
                    simplex_update_limit: number;
                    small_matrix_value: number;
                    solution_file: string;
                    solver:
                        | "choose"
                        | "simplex"
                        | "ipm"
                        | "ipx"
                        | "hipo"
                        | "pdlp"
                        | "qpasm"
                        | "hipdlp";
                    threads: number;
                    time_limit: number;
                    user_bound_scale: number;
                    user_cost_scale: number;
                    write_model_file: string;
                    write_model_to_file: boolean;
                    write_presolved_model_file: string;
                    write_presolved_model_to_file: boolean;
                    write_solution_style: SolutionStyle;
                    write_solution_to_file: boolean;
                },
            >,
        >

      Returns HighsSolution