I'm trying to solve a MIP using the SCIP command line, with the problem input in CPLEX LP format. However, due to large number of variables, the optimization is taking a lot of time. Is there some way to compute the LP Relaxtion solution of the same MIP in SCIP?
Or any other way to get an approximate, somewhat suboptimal solution?
If you are just interested in the LP relaxation you should try to use SoPlex to solve your problem.
If you want to limit the computation time in SCIP you can set a node limit, a solution limit, an objective limit, a time limit or a combination of these. You can find these settings in set/limits/ in the interactive shell
Related
what's the difference between optimal solution of cplex and the optimaltol solution of cplex?
1、When I solve a integer programming model with CPLEX solver, the result status of some instances show as “optimal”,however,the result status of some instances show as “optimalTol”. I want to konw the difference between optimal solution of cplex and the optimaltol solution of cplex?
2、My integer programming model is minimize the objective. when I solve the integer programming model with CPLEX solver,the result status is “optimalTol” and the objective value of the model is 1000 for example. When I add cplex.setParam(IloCplex::EpGap,0.0) for the solver. Then solve the model with CPLEX solver again. I want to know whether the value of the objective function will become larger or smaller?
This is relevant for any MIP solver.
A solver can stop for different reasons:
time limit or some other limit (iteration, node limit, etc.)
the gap tolerance has been met
the solution is proven optimal
The default gap tolerance is not zero, but rather something like 1e-4 (for the relative gap) and 1e-6 (for the absolute gap). That means that Cplex can stop while not being 100% sure that there are no better solutions. However, the gap tolerance will bound how much better the solution can be. E.g. if the relative gap tolerance is 1% and the absolute gap tolerance is 0 then the best possible solution cannot be farther away than 1%. If you set both to zero Cplex will need more time but always will deliver OPTIMAL (unless you hit a limit). If you allow a small gap, Cplex will most likely return OPTIMAL_TOL (we stopped because we met the gap tolerance) but in some case can be sure there is no better solution, in which case it will return OPTIMAL. For large, practical models we often are happy with a solution that is better than say 5% from the best possible.
I am trying to use z3 to solve an linear programming problem and observing very poor performance relative to GLPK. There are reasons why I would prefer to use z3 so I'm wondering if there is something I'm missing.
The problem is essentially bin packing. I have on the order of 500 weighted items, and 5 bins. Every item must be placed in a bin. Objective is to minimize the total weight in the largest bin.
The problem was solved within 1-2 minutes by GLPK. I have yet to see z3 terminate.
The z3 optimization tutorial suggests both a boolean encoding and an integer encoding for a similar type of problem. Is one of these preferred for performance reasons? Basically I'm wondering if you need to follow a certain pattern for z3 to recognize it as linear programming.
How do I know what method it's applying to solve the problem?
Is there a way to configure logging on z3 so you can see what it's doing.
By the way, I'm using the C++ API.
This is a follow up of my previous question on LP Relaxation of a MIP using SCIP.
Though I'm able to compute a LP Relaxation solution of my MIP by simply passing the MIP (in CPLEX format) to SoPlex, I observe that the computation time taken by SoPlex is higher than optimizing the MIP using SCIP itself (testing for smaller inputs).
As SCIP uses SoPlex internally before solving the MIP, how is this possible?
Moreover, my LP Relaxation result is actually giving integer solutions, and the same objective value as the MIP. Am I making a mistake in LP Relaxation? Or is it some property of my problem/formulation?
I'm referring to the total computation time printed by the solvers (not computed myself).
This behaviour most likely comes from SCIPs presolving routines, which shrink and reformulate the input MIP. You can verify this by looking at the SCIP output after starting the optimization, where SCIP prints the number of removed variables, removed constraints etc.
Sometimes, Integer formulations allow for stronger problem reductions.
If your problem contains, e.g., binary variables, a lot of them might get fixed when probing is performed: SCIP iteratively fixes the binary variables to 0 or 1, and if one fixation leads to an inconsistency, the variable gets fixed.
This behavior can be explained by the different presolving steps. SCIP's presolving is usually faster and removes more rows and columns than that of SoPlex. Please have a look at the respective information in the statistics. You can display the SCIP statistics in the interactive shell by typing display statistics, whereas SoPlex prints more info with the command line parameter -q (if you're using SoPlex 2.0).
Another thing you may try is parameter tuning. Have you tested different pricers (-p3 for devex, -p4 for steepest edge) or scalers (-g1 -g3 or -g4) in SoPlex? Run SoPlex without a problem to solve and it will show available parameters.
I am looking for an iterative linear system solver to calculate a continuously changing field. For the simulation to work properly, I need to re-calculate the field (maybe several times) for every time step. Fortunately, I have a good initial guess for each time step, so it is better I can feed it into an iterative solver. And the coefficient matrix is very dense.
The problem is I checked several iterative solvers online like Gmm++, IML++, ITL, DUNE/ISTL and so on. They are either for sparse systems or don't provide interfaces for inputting initial guesses (I might be wrong since I didn't have time to go through all the documents).
So I have two questions:
1 Is there any such c++ solver available online?
2 Since the coefficient matrix can be as large as thousands * thousands, could a direct solver be quicker than an iterative solver with a really good initial guess?
Great Thanks!
He
If you check the header for Conjugate Gradient in IML++ (http://math.nist.gov/iml++/cg.h.txt), you'll see that you can very easily provide the initial guess for the solution in the very variable where you'd expect to get the solution.
I have an integer linear optimisation problem and I'm interested in feasible, good solutions. As far as I know, for example the Gnu Linear Programming Kit only returns the optimal solution (given it exists).
This takes endless time and is not exactly what I'm looking for: I would be happy with any good solution, not only the optimal one.
So a LP-Solver that e.g. stops after some time and returns the best solution he found so far, would do the job.
Is there any such software? It would be great if that software was open source or at least free as in beer.
Alternatively: Is there any other way that usually speeds up Integer LP problems?
Is this the right place to ask?
Many solvers provide a time limit parameter; if you set the time limit parameter, they will stop once the time limit is reached. If an integer feasible solution has been found, it will return the best feasible solution found to that point.
As you may know, integer programming is NP-hard, and there is a real art to finding optimal solutions as well as good feasible solutions quickly. To compare the different solvers, see Prof. Hans Mittelmann's Benchmarks for Optimization Software. The MILP benchmarks - particularly MIPLIB2010 and the Feasibility Benchmark should be most relevant.
In addition to selecting a good solver, there are many things that can be done to improve solve times including tuning the parameters of the solver and model reformulation. Many people in research and industry - including myself - spend our careers working on improving the solve times of MIP models, both in general and for specific models.
If you are an academic user, note that the top commercial systems like CPLEX and Gurobi are free for academic use. See the respective websites for details.
Finally, you may want to look at OR-Exchange, a sister site to Stack Overflow that focuses on the field of operations research.
(Disclaimer: I currently work for Gurobi Optimization and formerly worked for ILOG, which provided CPLEX).
If you would like to get a feasibel integer solution fast and if you don't need the optimal solution, you can try
Increase the relative or absolute Gap. Usually solvers have small gaps of say 0.0001% for relative gap. This means that the solver will continue searching for MIP solutions until it the MIP solution is not farther than 0.0001% away from the optimal solution. Increase this gab to e.g. 1%., So you get good solution, but the solver will not spent a long time in proving optimality.
Try different values for solver parameters concerning MIP heuristics.
CPLEX and GUROBI have parameters to control, MIP emphasis. This means that the solver will put more emphasis on looking for feasible solutions or on proving optimality. Set emphasis to feasible MIP solutions.
Most solvers like CPLEX, Gurobi, MOPS or GLPK have settings for gap and heuristics. MIP emphasis can be set - as far as I know - only in CPLEX and Gurobi.
A usual approach for solving ILP is branch-and-bound. This utilized the solution of many sub-LP (without-I). The finally optimal result is the best of all sub-LP. As at least one solution is found you could stop anytime and would have a best-so-far.
One package that could do it, is the free lpsolve. Look there at set_timeout for giving a time limit, and when it is ILP the solve function can return in SUPOPTIMAL the best_so_far value.
As far as I know CPLEX can. It can return the solution pool which contains primal feasible solutions in the search, and if you specify the search focus on feasibility rather on optimality, more faesible solutions can be generated. At the end you can just export the pool. You can use the pool to do a hot start so it's pretty up to you. CPlex is free now at least in my country as you can sign up as a researcher.
Could you take into account Microsoft Solver Foundation? The only restriction is technology stack that you prefer and here you should use, as you guess, Microsoft technologies: C#, vb.net, etc. Here is example how to use it with Excel: http://channel9.msdn.com/posts/Modeling-with-Solver-Foundation-30 .
Regarding to your question it is possible to have not a fully optimized solutions if you set efficiency (for example 85% or 0.85). In outcome you can see all possible solutions for such restriction.