pythonscipy-optimizelinear-optimizationhighs

Is there a way to prevent "crossover" iterations when using scipy.optimize.libprog's solver "highs-ipm"?


Is there an option to prevent "crossover" when calling highs-ipm solver via scipy.optimize.linprog? It appears that the "standalone" solver (see https://github.com/ERGO-Code/HiGHS) has an option "--run_crossover arg". I just wonder if this is reachable via Python's scipy interface?

The documentation page for linpropg does not list this as a parameter, which of course suggests the negative answer. https://docs.scipy.org/doc/scipy/reference/optimize.linprog-highs-ipm.html


Solution

  • Since version 1.11.1 of scipy, it is possible to pass unknown options to the solver like run_crossover=False. Scipy will generate a warning but the options will be passed to the solver.

    It is possible to check the number of iterations performed in the crossover with sol.crossover_nit. The result should be 0.

    from scipy.optimize import linprog
    
    # Define c, A_ub, b_ub, A_eq, b_eq, bounds
    ...
    
    # Define options
    solver = 'highs-ipm'
    params = {'run_crossover': False}
    
    # Optimize
    sol = linprog(c, A_ub, b_ub, A_eq, b_eq, bounds, method=solver, options=params)
    
    # Check the number of iteration in crossover
    print(sol.crossover_nit)  # it should be 0
    

    You can check all options HighsOptions.pxd