Save Feasible Solutions SCIP - Python - OR Tools - scipy

I am new using SCIP with OR Tools and Python to solve a MIP problem with exact solution, for this reason I have two questions:
How can I get the feasible solutions for each of the iterations in the branch-and-bound? I would like to save the local optimum, highlighted with (*) in the graph:
Output Branch-and-Bound
How can I stop this branch-and-bound algorithm by “% gap” or “time”?

Related

OR-Tools optimization eith CP-Sat

I'm solving an optimization problem in python with OR-Tools / CP-sat solver. I'm using a file that takes some hours to reach optimal solution. Is there any way of seeing in the terminal how the process is going, like the best solution found so far, the elapsed time, etc...? I know that with cplex solver we can see this.
Thank you
First, you need to add log_search_progress:true to the parameters.
Second, a good way to speed solving it to use multiple workers. This is done by using the num_search_workers:XXX parameter. If you have a decent machine, XXX=8 is good. If you have a beefier machine, you can try XXX=12 or 16 (or more).

Can you feed OR-tools solver external data inbetween different solutions it finds?

I'm trying to solve a complex variant of a min-SAT problem. So far in the process I have two subproblems, both giving solution values that need to be considered in the objective function. However, only one of the two problems do I solve with the OR-tools cp_model module. The other is solved by an external algorithm. Now, ideally I would do the following:
cp-solver findes a solution to the first subproblem,
pause the solver,
solve the second subproblem with an external algorithm, taking as argument the solution found by the cp-solver,
feed the result of the external algorithm back to the cp-solver,
cp-solver now considers as the objective value the sum of the solution it itself found to first subproblem and the solution that was found by the external algorithm,
cp-solver goes to the next iteration and repeats steps 1-6 for a new assignment
So my question is: is there a functionality for Google OR-tools that lets me do something like steps 1-6 where the solver runs in cooperation with external algorithms and is fed values accordingly? I'm new to using this module so I'm unaware of what terms I could search for on Google to find what I need. Thanks a lot my friends. Best regards, 30centimeter.
In the cp-sat solver, solve() is stateless and a black box.
The only thing you can do is modify the model and resolve.

Running Dynare from Matlab

I am new to Dynare++ and I have really quick question I cannot seem to find the answer too.
What is the difference between these two commands and why is the output different?
!dynare++ --per 50 --sim 3 file_name.mod
dynare file_name.mod
In the first command its unable to find steady state values based on my initial values and in the second it can. Why?
The first command calls the standalone Dynare++ instead of Matab-based Dynare. The latter uses Matlab's solvers for numerically finding the steady state. Note that there is a dedicated forum for Dynare at https://forum.dynare.org

Estimating effort to port code from Matlab to Octave

I just read a fascinating paper: http://www.psy.cmu.edu/~ckemp/Papers/kempt08.pdf
In my opinion it takes the whole area of machine learning to a completely new level because it flexibly discovers the structure of data (and doesn't only try to find a best fit for an existing structure).
The code is also available: http://www.psy.cmu.edu/~ckemp/code/formdiscovery.html
I tried to do a few experiments of my own - but unfortunately I don't possess Matlab. I tried it with Octave but it only produced all kinds of error messages, which I don't understand (I am no expert on these programs).
Could anybody perhaps have a quick look if these problems can be solved easily (or at all)? Perhaps the solution will be an easy one (this is my hope after all).
This would really be a big help! I am very much looking forward to trying a few data sets of my own.
I didn't look into the source code, but if you are going to convert it, these links might help:
Porting programs from Matlab to Octave
Differences between Octave and MATLAB
I was recently looking for an answer to the same question and found this old post. Just to add my two cents for anyone else looking...
There is an Octave library called Missing Function Library that "Finds functions that are in Matlab but not in Octave". Also, there are a bunch of great packages (read "Toolboxes") for Octave as well on SourceForge. Hope this helps!

Matlab vs Aforge vs OpenCV

I am about to start a project in visual image-processing and have no had experience with Matlab, Aforge, OpenCV and was wondering if anyone had any experiences with these different software packages.
I was also wondering which of the three packages were most efficient I assume OpenCV but has anyone had any experience?
Thanks
Jamie.
The question you need to ask yourself is which is more important - your time or the computer's time. If your task is really simple, you may be able to code it up in MATLAB and have it work right off the bat. MATLAB is by far the easiest for development - a scripted language with built-in memory management, a huge array of provided functions, and a great interface for displaying and manipulating data while debugging.
On the other hand, MATLAB is at least an order of magnitude slower than compiled openCV code for many tasks. This is especially true if you use the intel performance primitives libraries.
If you know how to code in MATLAB, I would suggest writing and debugging your algorithms in that language, then porting them to c/c++ with openCV for speed. If there are only a couple of simple functions that you need to speed up, you can call c code from MATLAB, but it's hard to get this working right the first few times you try it, so you're probably better off just rewriting your finished code entirely in c/c++
First, please elaborate about your project's needs. It has the biggest impact on the choice, in addition to other factors - your general programming knowledge (If you haven't dealt with dot net but just with C++, AForge is not a good choice, for example).
Generally,
Both AForge and OpenCV has a built-in interface to .Net, and OpenCV also with C++, python, and more. Matlab might be more efficient, but if you don't have any experience with it - you should also learn its syntax. Take it into consideration.
Matlab probably has the largest variety of functions, but it is more complicated than the other projects. OpenCV and AForge themselves have some differences - see them described in this StackOverflow question/ answers.
I worked last year in two similar projects with cars on the highway. Afaik, Matlab allows to process only one picture frame at a time (surely you could elaborate an algorithm to compute a stream) but using Simulink you can process the stream directly.
On the other hand, i found AForge a lot friendlier and easier to use since you can easily adjust the processing parameters from a GUI (not so fast/easy) to do in Matlab/simulink.
I'd go for Aforge.Net. It's also fast enough if you're worrying about processing speed. (using 640x480)
If you are asking about using one of these in .net,easily you can get info by this:
1-matlab mostly used in simulation of projects not the End-prototype project; my numer : 30;
2-aforge (as I'v used in many project) if you do not need the circular process like capturing image, or recognition of something in images or ... you'll find it very good, cause it is easy to use but useful for single processes; my number : 50
3-opencv very good at speed and useful for circular processes, for example you can capture images from a webcam and Instantly cartoonize it without any delay, But not easy-to-use as aforge. I like it anyway cause of its speed and MANY functions it gives us mostly anything we need in programming; my number : 80
Dr.Taha - Tahasoft.net