How to install a minizinc solver - sat-solvers

In MiniZinc (windows IDE) How can I resolve:
flatzinc: error: variables of type `var float' are not supported by the FD solver backend.
I realize I need a different solver but could not find a procedure installing one and the Preferences dlg does not seem to work. Also, not clear which solver would work.

The G12/fd solver don't support float decision variables. Do you find G12 MIP solver in the "Solver" list? If so, try it and see if it can solve the model. There is a Help text ("Help, Help...") that might help you add the solver if not.
However, if it's an non-linear model then G12/mip might complain, and you have to try another solver. Gecode and JaCoP has some support for non-linear float models.
In MiniZinc 2.0 it might work with G12/mip and a non-linear model if the "-G linear" flag is used: mzn2fzn will then linearize non-linear constraints.

Related

Get infeasibilities with IBM cplex feasopt python's interface

I am using IBM CPLEX python's API to solve a linear program.
The linear program I am solving turned out to be infeasible, so I am using feasopt() from CPLEX to relax the problem.
I could get a feasible solution through my_prob.feasopt(my_prob.feasopt.all_constraints()), where feasopt relaxes all the constraints.
But I am interested in getting the amount of relaxation for each constraint. Particularly, in the documentation it says In addition to that conventional solution vector, FeasOpt also produces a vector of values that provide useful information about infeasible constraints and variables.
I am interested in getting this vector.
I believe you are looking for the methods available under the Cplex.solution.infeasibility interface.
Example usage:
# query the infeasibilities for all linear constraints
rowinfeas = my_prob.solution.infeasibility.linear_constraints(
my_prob.solution.get_values())

using Bonmin Counne and Ipopt for NLP

I want to just be sure that I am eligible to use Bonmin and Couenne for solving just the NLP problem (Still I do not have integer variable) and I am eager to obtain global optimum not local. I also read that Ipopt first search for the global answer and if it does not find that it will provide a local answer. How I can understand my answer is a global answer when I using Ipopt. Also, I want to what is the best NLP and MINLP open source pythonic solvers for these issues that can be merged with Pyomo?
The main reason for my question is the following output using Bonmin:
NOTE: You are using Ipopt by default with the MUMPS linear solver.
Other linear solvers might be more efficient (see Ipopt documentation).
Regards
Some notes:
(1) "Ipopt first search for the global answer and if it does not find that it will provide a local answer" This is probably not how I would phrase it. IPOPT finds local solutions. For some problems these will be the global solution. For convex problems, this is always the case (except for numerical issues).
(2) Bonmin is a local MINLP solver, Couenne is a global NLP/MINLP solver. Typically Bonmin can solve larger problems than Couenne, but you get local solutions.
(3) "NOTE: You are using Ipopt by default with the MUMPS linear solver. Other linear solvers might be more efficient (see Ipopt documentation)." This is just a notification that you are using IPOPT with linear algebra routines from MUMPS. There are other linear sub-solvers that IPOPT can use and that may perform better on large problems. Often the HARWELL routines (typically called MAnn) give better performance. MUMPS is free while the Harwell routines require a license.
In a follow-up answer (well it is not answer at all) it is stated:
Regarding Ipopt how I can understand that it is finding the global
solution or local optimum? the code will notify that? Regarding to
Bonmin according to AMPL page AMPL It provides the global solution for
the convex problem " Finds globally optimal solutions to convex
nonlinear problems in continuous and discrete variables, and may be
applied heuristically to nonconvex problems." And you were saying that
it is obtained the local solution, I am a bit confused on this part.
But the general question about all those codes is that how I can find
out that the answer is global optimum?
(a) Ipopt does not know if a solution is a local or a global optimal solution. For convex problems a local optimum is a global optimal solution. You will need to convince yourself the problem you pass on to Ipopt is convex (Ipopt will not do this for you).
(b) Bonmin: the same: if the problem is convex it will find global solutions. Otherwise you will get a local solution. You will get no notification whether a solution is a global solution: Bonmin does not know if a solution is a global optimum.
(c) When looking for guaranteed global solutions you can use a local solver only when the problem is convex. For other problems you need a global solver. Another approach is to use a multi-start algorithm with a local solver. That gives you confidence that you are not ending up with a bad local optimum.
If possible, I suggest to discuss this with your teacher. These concepts are important to understand (and most solver manuals assume you know about them).

irreducible infeasible set (IIS) in gurobi, from minizinc

Is there a way to get the IIS from Gurobi if I use it via the minizinc interface (i.e., mzn-gurobi) ?
Thanks,
Ofer
Currently no such option exists for mzn-gurobi. All available options can be seen by checking the help output: mzn-gurobi -h. Generally the options are for linear solvers (CBC, CPLEX, Gurobi) are shared. If you are missing this functionality, I would suggest making a feature request on the MiniZinc repository. (Note that this functionality wouldn't be able to point to the constraints in the MiniZinc model, only the generated FlatZinc constraints)
What is in development within MiniZinc are Minimal Unsatisfiable Sets, which in my understanding are the same. A special kind of MiniZinc solver is in development that will give a subset of constraints, in MiniZinc, that violate a model. Although it seems development is going strong, it might be a while before this program will be released. If you have an immediate need for such a tool, you can try contacting the MiniZinc Team.

Gurobi resume optimization after model modification

As far as i know Gurobi resumes optimizing where it left after calling Model.Terminate() and then calling Model.Optimize() again. So I can terminate and get the best solution so far and then proceed.Now I want to do the same, but since I want to use parts of the suboptimal solution I need to set some variables to fixed values before I call Model.Optimize() again and optimize the rest of the model. How can i do this so that gurobi does not start all over again?
First, it sounds like you're describing a mixed-integer program (MIP); model modification is different for continuous optimization (linear programming, quadratic programming).
When you modify a MIP model, the tree information is no longer helpful. Instead, you must resolve the continuous (LP) relaxation and create a new branch-and-cut tree. However, the prior solution may still be used as a MIP start, which can reduce the solve time for the second model.
However, your method may be redundant with the RINS algorithm, which is an automatic feature of Gurobi MIP. You can control the behavior of RINS via the parameters RINS, SubMIPNodes and Heuristics.

How to verify SCIP compiled with Ipopt?

I am using SCIP via Julia (currently with SCIP.jl, previous with AmplNLWriter.jl). I compiled SCIP as follows per the instructions for SCIP.jl:
make SHARE=true GMP=false IPOPT=true READLINE=false ZLIB=false scipoptlib
I am able to call SCIP from Julia. I also confirmed SCIP works with make test. However, when I try to solve a (presumably non-convex) MINLP, I get the following warning message:
Quadratic constraint handler does not have LAPACK for eigenvalue computation. Will assume that matrices (with size > 2x2) are indefinite.
This message makes me suspect SCIP is actually not using IPOPT. How can I resolve this message and verify SCIP is, in fact, using IPOPT?
My model has many bilinear terms, some of which may lead to convex constraints. Thus I anticipate using IPOPT will accelerate SCIP.
Thanks, Alex
There is a method to print this information: SCIPprintExternalCodes().