Charlie
Charlie

Reputation: 469

Fixed-point bounds for optimisation using scipy linprog

I want to run an optimisation problem repeatedly to further refine the end result.

Essentially, the objective is to minimise the maximum of a set of variables (subject to inequality and equality constraints), and then minimise the maximum of the set excluding the maximum, and then minimise the maximum of the set excluding the two largest numbers and so on...

The algorithm I have in mind is:

  1. Run scipy.linprog(..., bounds=[(-numpy.inf, numpy.inf), (-numpy.inf, numpy.inf), (-numpy.inf, numpy.inf), ...]) with all variables unbounded, to minimise the maximum of the set of numbers.
  2. Assuming optimisation problem is feasible and successfully solved, fix the maximum to opt_val by setting bounds=[..., (opt_val, opt_val), ...], where all other variables have the bounds (-numpy.inf, numpy.inf).
  3. Make inequality constraints corresponding to that variable ineffective, by changing the coefficient of b_ub to numpy.inf.
  4. Rerun simulation with modified bounds and inequality vector.

This can run without error, but it seems like scipy/numpy explicitly ignore the bounds I place on the variables - I get results for the variables that I have 'fixed' that are not the corresponding opt_val.

Can scipy handle bounds that restrict a variable to a single floating point number? Is this the best way to be solving my problem?

The code I have developed is really quite extensive, which is why I have not posted it here, so of course I don't expect a code-based solution. What I am looking for here is a yes/no answer as to whether scipy can handle bounding intervals restricted to a single float, and, on a higher level, whether I have the correct approach.

The documentation at https://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.optimize.linprog.html does not explicitly say whether or not it is possible to specify fixed-point bounds.

Upvotes: 1

Views: 1034

Answers (1)

Charlie
Charlie

Reputation: 469

It turns out it was a problem with relaxing the inequality constraints. I had mistakenly relaxed all constraints regarding the fixed variables, when instead I needed to have relaxed some of the constraints.

@ErwinKalvelagen's comment is still worth noting however.

Upvotes: 0

Related Questions