lanl-ansi / WaterModels.jl

A Julia/JuMP Package for Water Distribution Network Optimization
https://lanl-ansi.github.io/WaterModels.jl/latest/
Other
70 stars 11 forks source link

Mathematical forms #15

Closed rb004f closed 5 years ago

rb004f commented 6 years ago

It looks like you want 3 mathematical forms

MINLP - the mixed integer non linear programming form MICP - the mixed integer convex programming form (relaxation) MILP - the mixed integer linear programing form (the piecewise linear relaxation of the MICP)

Then, in the implementations of the various variable creation functions, the necessary variables and constraints can be added. For example, in GasModels, there is a function variable_flow. If the mathematical form is undirected, the implementation of this function creates direction variables. If the mathematical form is directed, the implementation does not.

ie.

function variable_flow{T <: AbstractMIForms}(gm::GenericGasModel{T}, n::Int=gm.cnw; bounded::Bool = true) variable_mass_flow(gm,n; bounded=bounded) variable_connection_direction(gm,n)
end

vs.

function variable_flow{T <: AbstractMIDirectedForms}(gm::GenericGasModel{T}, n::Int=gm.cnw; bounded::Bool = true) variable_mass_flow(gm,n; bounded=bounded) end

Eventually we will want to include the NLP form that encodes the sign (abs) without resorting to direction variables, but that will be much later

tasseff commented 6 years ago

What do you think about having some notion of the inequality relaxation of the head loss constraint when describing the problem type? For example, in the current "development" branch, I now have essentially five formulations.

  1. The full non-convex MINLP (without the relaxation).
  2. The relaxed (convex) version of the above MINLP.
  3. A MILP using a piecewise linear approximation with equality constraints (where I successfully use PiecewiseLinearOpt.jl).
  4. A MILP using a piecewise outer approximation with inequality constraints.
  5. An NLP, which currently assumes that flow directions must be fixed.

Numbers (1) - (4) also include corresponding constraints for the fixed-direction cases. Anyway, the essential difference between (1) and (2) is the relaxation from equality to inequality, and the difference between (3) and (4) is also the relaxation from equality to inequality. Sure, there are some additions of variables and constraints to accomplish this, but nothing else changes.

Furthermore, I think it's sort of deceiving to give a formulation its own name when it's not solving the equality-constrained problem. Something like RMINLP (relaxed MINLP) makes more sense to me since it specifically calls out that a relaxation has been performed. Similarly, we could then call the relaxed MILP RMILP without any loss of consistency in naming.

Anyway, I don't really know the convention for this sort of thing, so I am deferring to @rb004f and @ccoffrin!

rb004f commented 6 years ago

It sounds like your are looking for a name for 2? Usually for these we give it the name of the underlying relaxation, i.e. MIQP would be mixed integer quadratic and miscop would be mixed integer second order cone. Our convention is not explicitly use relaxation in the name, the fact that there exists a non convex form implies that the convex forms are a relaxation of the original.

We will want to carefully document the differences between 3 and 4. It looks like 3 is an approximation whereas 4 is a relaxation. We've never done something like 3 for the other models (at least not yet).

ccoffrin commented 6 years ago

The current convention is motivated in Code Block 5 in this paper, https://arxiv.org/abs/1711.01728.

My goal is that the underlying problem you are trying to solve remains the same and relaxation / approximation of that underlying master problem is encoded in the formulation parameter.

I imagine a user who always wants to solve the master problem, but from time to time resorts to a relaxation (quality bound or infeasibility proof) or an approximation (master NLP is too hard).