Mixed integer programming routines

Problem.set_col_kind(col, str kind)

Set (change) column kind

Parameters:
  • col (int or str) – the index or name of the column
  • kind (str) – the column kind, either 'continuous', 'integer', or 'binary'
Problem.get_col_kind(col)

Retrieve column kind

Parameters:col (int or str) – the index or name of the column
Returns:the column kind, either 'continuous', 'integer', or 'binary'
Return type:str
Problem.get_num_int()

Retrieve number of integer columns

Returns:the number of integer columns
Return type:int
Problem.get_num_bin()

Retrieve number of binary columns

Returns:the number of binary columns
Return type:int
Problem.intopt(IntOptControls controls)

Solve MIP problem with the branch-and-bound method

Problem.mip_status()

Retrieve status of MIP solution

Problem.mip_obj_val()

Retrieve objective value (MIP solution)

Returns:the objective value of the MIP solution
Return type:float
Problem.mip_row_val(row)

Retrieve row value (MIP solution)

Parameters:row (int or str) – the index or name of the row
Returns:the solution value
Return type:float
Problem.mip_col_val(col)

Retrieve column value (MIP solution)

Parameters:col (int or str) – the index or name of the column
Returns:the solution value
Return type:float

Integer optimization controls

class ecyglpki.IntOptControls

The integer optimization solver control parameter object

>>> r = IntOptControls()
binarize

Whether to binarize integer variables, a bool

This option is only used if presolve is True.

>>> r.binarize  # the GLPK default
False
>>> r.binarize = True
>>> r.binarize
True
br_tech

The branching technique, a str

The possible values are

  • 'first_fracvar': first fractional variable
  • 'last_fracvar': last fractional variable
  • 'most_fracvar': most fractional variable
  • 'Driebeek-Tomlin': heuristic by Driebeek & Tomlin
  • 'hybrid_peudocost': hybrid pseudocost heuristic
>>> r.br_tech  # the GLPK default
'Driebeek-Tomlin'
>>> r.br_tech = 'most_fracvar'
>>> r.br_tech
'most_fracvar'
bt_tech

The backtracking technique, a str

The possible values are

  • 'depth': depth first search
  • 'breadth': breadth first search
  • 'bound': best local bound
  • 'projection': best projection heuristic
>>> r.bt_tech  # the GLPK default
'bound'
>>> r.bt_tech = 'projection'
>>> r.bt_tech
'projection'
cb_func

Callback routine

Warning

This functionality has not been tested and is most likely broken; see https://github.com/equaeghe/ecyglpki/issues/7

cb_info

Transit pointer passed to the routine cb_func

Warning

This functionality has not been tested and is most likely broken; see https://github.com/equaeghe/ecyglpki/issues/7

cb_size

Number of extra bytes allocated for each search tree node, an int

Up to 256 bytes can be allocated for each node of the branch-and-bound tree to store application-specific data. On creating a node these bytes are initialized by binary zeros.

>>> r.cb_size  # the GLPK default
0
>>> r.cb_size = 128
>>> r.cb_size
128
clq_cuts

Whether to generate generate clique cuts, a bool

>>> r.clq_cuts  # the GLPK default
False
>>> r.clq_cuts = True
>>> r.clq_cuts
True
cov_cuts

Whether to generate mixed cover cuts, a bool

>>> r.cov_cuts  # the GLPK default
False
>>> r.cov_cuts = True
>>> r.cov_cuts
True
fp_heur

Whether to apply the feasibility pump heuristic, a bool

>>> r.fp_heur  # the GLPK default
False
>>> r.fp_heur = True
>>> r.fp_heur
True
gmi_cuts

Whether to generate Gomory’s mixed integer cuts, a bool

>>> r.gmi_cuts  # the GLPK default
False
>>> r.gmi_cuts = True
>>> r.gmi_cuts
True
mip_gap

The relative MIP-gap tolerance, a Real number

The search stops once the relative MIP-gap falls below this value.

>>> r.mip_gap  # the GLPK default
0.0
>>> r.mip_gap = 0.1
>>> r.mip_gap
0.1
mir_cuts

Whether to generate mixed integer rounding cuts, a bool

>>> r.mir_cuts  # the GLPK default
False
>>> r.mir_cuts = True
>>> r.mir_cuts
True
msg_lev

The message level, a str

The possible values are

  • 'no': no output
  • 'warnerror': warnings and errors only
  • 'normal': normal output
  • 'full': normal output and informational messages
>>> r.msg_lev  # the GLPK default
'full'
>>> r.msg_lev = 'no'
>>> r.msg_lev
'no'
out_dly

Output delay [ms] of current LP relaxation solution, an int

>>> r.out_dly  # the GLPK default
10000
>>> r.out_dly = 5000
>>> r.out_dly
5000
out_frq

Output frequency [ms] of informational messages, an int

>>> r.out_frq  # the GLPK default
5000
>>> r.out_frq = 10000
>>> r.out_frq
10000
pp_tech

The preprocessing technique, a str

The possible values are

  • 'none': disable preprocessing
  • 'root': preprocessing only on the root level
  • 'all': preprocessing on all levels
>>> r.pp_tech  # the GLPK default
'all'
>>> r.pp_tech = 'root'
>>> r.pp_tech
'root'
presolve

Whether to use the MIP presolver, a bool

Using the MIP presolver may simplify the problem.

>>> r.presolve  # the GLPK default
False
>>> r.presolve = True
>>> r.presolve
True
ps_heur

Whether to apply the proximity search heuristic, a bool

>>> r.ps_heur  # the GLPK default
False
>>> r.ps_heur = True
>>> r.ps_heur
True
ps_tm_lim

Time limit [ms] for the proximity search heuristic, an int

>>> r.ps_tm_lim  # the GLPK default
60000
>>> r.ps_tm_lim = 30000
>>> r.ps_tm_lim
30000
sr_heur

Whether to apply the simple rounding heuristic, a bool

>>> r.sr_heur  # the GLPK default
True
>>> r.sr_heur = False
>>> r.sr_heur
False
tm_lim

Time limit [ms], an int

>>> r.tm_lim  # the GLPK default
2147483647
>>> r.tm_lim = 3600000  # one hour
>>> r.tm_lim
3600000
tol_int

Abs. tolerance for LP solution integer feasibility, a Real number

This is the absolute tolerance used to check if the optimal solution to the current LP relaxation is integer feasible.

>>> r.tol_int  # the GLPK default
1e-05
>>> r.tol_int = 1e-04
>>> r.tol_int
0.0001
tol_obj

Rel. tolerance of LP objective optimality, a Real number

This is the relative tolerance used to check if the objective value in the optimal solution to the current LP relaxation is not better than in the best known integer feasible solution.

>>> r.tol_obj  # the GLPK default
1e-07
>>> r.tol_obj = 1e-06
>>> r.tol_obj
1e-06