want_infeasibility_certificates::Bool = true,
    method::MethodEnum = GLPK.SIMPLEX,

Create a new Optimizer object.


  • want_infeasibility_certificates::Bool: flag to control whether to attempt to generate an infeasibility certificate in the case of primal or dual infeasibility. Defaults to true. You should set this to false if you want GLPK to report primal or dual infeasiblity, but you don't need a certificate.

  • method::MethodEnum: Solution method to use. Default is GLPK.SIMPLEX. Other options are GLPK.EXACT and GLPK.INTERIOR.

    problem::Union{Optimizer, Ptr{glp_prob}},

Helper function to add a row to the problem. Sense must be one of 'E' (ax == b), 'G' (ax >= b), 'L' (ax <= b).


Return true if an infeasiblity certificate or an unbounded ray is potentially available (i.e., the model has been solved using either the Simplex or Exact methods).

_get_infeasibility_ray(model::Optimizer, ray::Vector{Float64})

Compute a Farkas certificate of primal infeasibility (unbounded dual ray) and store in ray. Returns true if successful, and false if a ray cannot be found.

Assumes ray has been initialized to all 0.0s.

_get_unbounded_ray(model::Optimizer, ray::Vector{Float64})::Bool

Compute an unbounded primal ray and store in ray. Returns true if successful, and false if a ray cannot be found.

Assumes the primal has been solved with primal simplex and is proven unbounded. Assumes ray has been initialized to all 0.0s.


GLPK does not allow integer variables with fractional bounds. Therefore, we round the bounds of binary and integer variables to integer values prior to solving.

Returns a tuple (column, lower, upper) for the bounds that need to be reset.

_set_parameter(param_store, key::Symbol, value)::Bool

Set the field name key in a param_store type (that is one of InteriorParam, IntoptParam, or SimplexParam) to value.

Returns a Bool indicating if the parameter was set.

_validate_constraint_types(dest::Optimizer, src::MOI.ModelLike)

Throw an error if unsupported constraint or objective types are present in src.


GLPK uses 1-based indexing for its arrays. But since C has 0-based indexing, all 1-based vectors passed to GLPK need to be padded with a "0'th" element that will never be accessed. To avoid doing this padding in Julia, we convert the vector to a reference, and use the optional second argument to ensure the reference points to the "0'th" element of the array. This is safe to do, provided C never accesses x[0].

See the GLPK manual for more details.