Search code examples
optimizationsolverampl

Optimizer supporting `or` and `count` constraints in AMPL


I have designed an AMPL model.

I want to add to it some constraints such as:

s.t. Max_dif_prod {t in 1..T}: 
    count {p in PRODUCTS} (production[p,t] > 0) <= max_dif_prod ;

s.t. Min_prod {p in PRODUCTS, t in 1..T}:
    production[p,t] = 0 or production[p,t] >= min_production[p] ;

But neither the default solver (MINOS) nor the open source non linear solvers listed in the AMPL webpage (IPOPT, BONMIN and COUENNE) seem to be able to handle this type of constraints, and since I am in a demo version the proprietary AMPL non linear solvers are out of the question.

What solver can I use instead if I want these kind of restrictions? Or how can I substitute them by restrictions that any of the solvers I mentioned above may be able to solve?


Solution

  • The chapter about integer programming in the AMPL book has helped me solve this question.

    The solution I implemented was to reformulate the restrictions using binary variables and then use the CPLEX solver.