Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# lp2.m

    function lp2()
    % Copyright 2025, Gurobi Optimization, LLC
    %
    % Formulate a simple linear program, solve it, and then solve it
    % again using the optimal basis.

    model.A = sparse([1 3 4; 8 2 3]);
    model.obj = [1 2 3];
    model.rhs = [4 7];
    model.sense = ['>' '>'];

    % First solve requires a few simplex iterations
    result = gurobi(model)

    % Second solve - start from an optimal basis, so no iterations
    model.vbasis = result.vbasis;
    model.cbasis = result.cbasis;
    result = gurobi(model)
    end

Help and Feedback

Press `/` or click to search this documentation | Gurobi website | Gurobi community forum
Go to other Gurobi documentation | Gurobi download | Contact support