why is the ORTOOLS guided local search, that starts with a feasible solution considered constraint programming? - optimization

I'm using the ORTOOLS library for solving a VRP problem. I give it an initial feasible solution to my problem, satisfying all the constraints of my problem but sub-optimal. Then ORTOOLS performs a GUIDED_LOCAL_SEARCH heuristic, continuously perturbing parts of my solution (possibly making it infeasible at times) until it hopefully reaches a better solution than my initial solution.
Why is it using a constraint programming solver? My understanding is that classic constraint programming starts with an infeasible (possibly empty) solution, propagates the constraints to narrow the domains of my variables until reaching a stationary state, and then makes a decision. Then it iterates again until solving the problem or backtracks if reaching a dead-end (think SUDOKU).
In what way are these capabilities (propagation, backtracking) needed when making the small perturbations?

There are two reasons.
1) The initial solution heuristics is a combination of fast LS heuristic search and standard constraint programming search.
2) The whole local search implementation is build on top of a traditional constraint programming solver and uses constraints and propagators to validate solution, and complete them.
See: https://github.com/google/or-tools/issues/920

Related

VRP with clustered routes using optaplanner

I am using optaplaner to solve a vehicle routing problem, I apply different constraint providers to enforce weight and volume capacities, time windows, etc.
I am getting routes, which as shown in the image are elongated in direction.
And my question is: How to obtain clustered routes as shown in the following image, what constraint could I implement or what algorithm should I activate in obtaplanner to obtain a similar behavior?
I value very much any idea or input. Thanks!
You have to answer a question which I can not answer for you. Why are clustered routes preferrable? Are they shorter in driving distance? Are there legal requirements for maximum distance driven from a depot? Something else?
Once you have an answer to that, write a constraint for that criteria.
You may possibly find some inspiration in the facility location quickstart.
This is an active area of reserach.
Some ideas as how you may be able to achieve this:
Add metrics to the optimization target if minimized the routes are more clustered (e.g. bounding box, area of a route, cross-overs between routes, average squared distance to the route's center). The con to this approach is that often these metrics slow the solver down rather significantly.
Cluster first, route second algorithms. You can create cluster first and set a hard constraint that these clusters are not to be broken. The con to this approach is that you may not use the "optimal" amount of resources.
Cluster first, route second algorithms, but with an objective to not break up the clusters. The con to this approach is that the clusters may not be respected if there are better solutions where the cluster needs to be broken up.
That's all I have for now. In my experience the time window constraint is often the most constraining factor, and having narrow time windows often contribute to what is perceived as "messy" routes. See if you can relax one or more constraints if you can.

What is the difference between SAT and linear programming

I have an optimization problem that is subjected to linear constraints.
How to know which method is better for modelling and solving the problem.
I am generally asking about solving a problem as a satisfiability problem (SAT or SMT) vs. Solving as a linear programming problem (ILP OR MILP).
I don't have much knowledge in both. So, please simplify your answer if you have any.
Generally speaking, the difference is that SAT is only trying for feasible solutions, while ILP is trying to optimize something subject to constraints. I believe some ILP solvers actually use SAT solvers to get an initial feasible solution. The sensor array problem you describe in a comment is formulated as an ILP: "minimize this subject to that." A SAT version of that would instead pick a maximum acceptable number of sensors and use that as a constraint. Now, this is a satisfiability problem, but not one that's easily expressed in conjunctive normal form. I'd recommend using a solver with a theory of integers. My favorite is Z3.
However, before you give up on optimizing, you should try GMPL / GLPK. You might be surprised by how tractable your problem is. If you're not so lucky, turn it into a satisfiability problem and bring out Z3.

How are customized heuristics implemented to optimization problems (in IDE) and solvers?

I have read up on several papers that described the use of heuristics in various routing problems that results in a faster run time for the solvers used (e.g. Gecode, CBC). For e.g., in the CPLEX/MiniZinc IDE, we have a constraint problem for the Vehicle Routing Problem (VRP), and a data file with contains the locations which the vehicle needs to go to (.dzn file in MiniZinc). Then, the authors in these papers implemented various kinds of routing heuristics to obtain a solution (may not be optimal) for each constraint model.
Thus my question is, how are the heuristics (can be customized to one that you designed, that is not built-in with he solver) implemented? Are the heuristics done in another IDE?
I have been looking around online literature but have yet to find out how this is actually done, especially for the case of MiniZinc and Cplex with the Gecode solver for example. It will be great if some insight can be shared on this issue! :)

Optimizing assignments based on many variables

I was recently talking with someone in Resource Management and we discussed the problem of assigning developers to projects when there are many variables to consider (of possibly different weights), e.g.:
The developer's skills & the technology/domain of the project
The developer's travel preferences & the location of the project
The developer's interests and the nature of the project
The basic problem the RM person had to deal with on a regular basis was this: given X developers where each developers has a unique set of attributes/preferences, assign them to Y projects where each project has its own set of unique attributes/requirements.
It seems clear to me that this is a very mathematical problem; it reminds me of old optimization problems from algebra and/or calculus (I don't remember which) back in high school: you know, find the optimal dimensions for a container to hold the maximum volume given this amount of material—that sort of thing.
My question isn't about the math, but rather whether there are any software projects/libraries out there designed to address this kind of problem. Does anyone know of any?
My question isn't about the math, but rather whether there are any software projects/libraries out there designed to address this kind of problem. Does anyone know of any?
In my humble opinion, I think that this is putting the cart before the horse. You first need to figure out what problem you want to solve. Then, you can look for solutions.
For example, if you formulate the problem by assigning some kind of numerical compatibility score to every developer/project pair with the goal of maximizing the total sum of compatibility scores, then you have a maximum-weight matching problem which can be solved with the Hungarian algorithm. Conveniently, this algorithm is implemented as part of Google's or-tools library.
On the other hand, let's say that you find that computing compatibility scores to be infeasible or unreasonable. Instead, let's say that each developer ranks all the projects from best to worst (e.g.: in terms of preference) and, similarly, each project ranks each developer from best to worst (e.g.: in terms of suitability to the project). In this case, you have an instance of the Stable Marriage problem, which is solved by the Gale-Shapley algorithm. I don't have a pointer to an established library for G-S, but it's simple enough that it seems that lots of people just code their own.
Yes, there are mathematical methods for solving a type of problem which this problem can be shoehorned into. It is the natural consequence of thinking of developers as "resources", like machine parts, largely interchangeable, their individuality easily reduced to simple numerical parameters. You can make up rules such as
The fitness value is equal to the subject skill parameter multiplied by the square root of the reliability index.
and never worry about them again. The same rules can be applied to different developers, different subjects, different scales of projects (with a SLOC scaling factor of, say, 1.5). No insight or real leadership is needed, the equations make everything precise and "assured". The best thing about this approach is that when the resources fail to perform the way your equations say they should, you can just reduce their performance scores to make them fit. And if someone has already written the tool, then you don't even have to worry about the math.
(It is interesting to note that Resource Management people always seem to impose such metrics on others in an organization -- thereby making their own jobs easier-- and never on themselves...)

Looking for ideas/references/keywords: adaptive-parameter-control of a search algorithm (online-learning)

I'm looking for ideas/experiences/references/keywords regarding an adaptive-parameter-control of search algorithm parameters (online-learning) in combinatorial-optimization.
A bit more detail:
I have a framework, which is responsible for optimizing a hard combinatorial-optimization-problem. This is done with the help of some "small heuristics" which are used in an iterative manner (large-neighborhood-search; ruin-and-recreate-approach). Every algorithm of these "small heuristics" is taking some external parameters, which are controlling the heuristic-logic in some extent (at the moment: just random values; some kind of noise; diversify the search).
Now i want to have a control-framework for choosing these parameters in a convergence-improving way, as general as possible, so that later additions of new heuristics are possible without changing the parameter-control.
There are at least two general decisions to make:
A: Choose the algorithm-pair (one destroy- and one rebuild-algorithm) which is used in the next iteration.
B: Choose the random parameters of the algorithms.
The only feedback is an evaluation-function of the new-found-solution. That leads me to the topic of reinforcement-learning. Is that the right direction?
Not really a learning-like-behavior, but the simplistic ideas at the moment are:
A: A roulette-wheel-selection according to some performance-value collected during the iterations (near past is more valued than older ones).
So if heuristic 1 did find all the new global best solutions -> high probability of choosing this one.
B: No idea yet. Maybe it's possible to use some non-uniform random values in the range (0,1) and i'm collecting some momentum of the changes.
So if heuristic 1 last time used alpha = 0.3 and found no new best solution, then used 0.6 and found a new best solution -> there is a momentum towards 1
-> next random value is likely to be bigger than 0.3. Possible problems: oscillation!
Things to remark:
- The parameters needed for good convergence of one specific algorithm can change dramatically -> maybe more diversify-operations needed at the beginning, more intensify-operations needed at the end.
- There is a possibility of good synergistic-effects in a specific pair of destroy-/rebuild-algorithm (sometimes called: coupled neighborhoods). How would one recognize something like that? Is that still in the reinforcement-learning-area?
- The different algorithms are controlled by a different number of parameters (some taking 1, some taking 3).
Any ideas, experiences, references (papers), keywords (ml-topics)?
If there are ideas regarding the decision of (b) in a offline-learning-manner. Don't hesitate to mention that.
Thanks for all your input.
Sascha
You have a set of parameter variables which you use to control your set of algorithms. Selection of your algorithms is just another variable.
One approach you might like to consider is to evolve your 'parameter space' using a genetic algorithm. In short, GA uses an analogue of the processes of natural selection to successively breed ever better solutions.
You will need to develop an encoding scheme to represent your parameter space as a string, and then create a large population of candidate solutions as your starting generation. The genetic algorithm itself takes the fittest solutions in your set and then applies various genetic operators to them (mutation, reproduction etc.) to breed a better set which then become the next generation.
The most difficult part of this process is developing an appropriate fitness function: something to quantitatively measure the quality of a given parameter space. Your search problem may be too complex to measure for each candidate in the population, so you will need a proxy model function which might be as hard to develop as the ideal solution itself.
Without understanding more of what you've written it's hard to see whether this approach is viable or not. GA is usually well suited to multi-variable optimisation problems like this, but it's not a silver bullet. For a reference start with Wikipedia.
This sounds like hyper heuristics which you're trying to do. Try looking for that keyword.
In Drools Planner (open source, java) I have support for tabu search and simulated annealing out the box.
I haven't implemented the ruin-and-recreate-approach (yet), but that should be easy, although I am not expecting better results. Challenge: Prove me wrong and fork it and add it and beat me in the examples.
Hyper heuristics are on my TODO list.