In
computer science
Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to practical disciplines (includin ...
, the min-conflicts algorithm is a
search algorithm
In computer science, a search algorithm is an algorithm designed to solve a search problem. Search algorithms work to retrieve information stored within particular data structure, or calculated in the Feasible region, search space of a problem do ...
or heuristic method to solve
constraint satisfaction problem
Constraint satisfaction problems (CSPs) are mathematical questions defined as a set of objects whose state must satisfy a number of constraints or limitations. CSPs represent the entities in a problem as a homogeneous collection of finite constr ...
s.
Given an initial assignment of values to all the variables of a constraint satisfaction problem, the algorithm randomly selects a variable from the set of variables with conflicts violating one or more its constraints.
Then it assigns to this variable the value that minimizes the number of conflicts. If there is more than one value with a minimum number of conflicts, it chooses one randomly. This process of random variable selection and min-conflict value assignment is iterated until a solution is found or a pre-selected maximum number of iterations is reached.
Because a constraint satisfaction problem can be interpreted as a
local search problem when all the variables have an assigned value (called a complete state), the min conflicts algorithm can be seen as a repair
heuristic
A heuristic (; ), or heuristic technique, is any approach to problem solving or self-discovery that employs a practical method that is not guaranteed to be optimal, perfect, or rational, but is nevertheless sufficient for reaching an immediat ...
that chooses the state with the minimum number of conflicts.
Algorithm
algorithm MIN-CONFLICTS is
input: console.''csp'', A constraint satisfaction problem.
''max_steps'', The number of steps allowed before giving up.
''current_state'', An initial assignment of values for the variables in the csp.
output: A solution set of values for the variable or ''failure''.
for i ← 1 to max_steps do
if ''current_state'' is a solution of ''csp'' then
return ''current_state''
set ''var'' ← a randomly chosen variable from the set of conflicted variables CONFLICTED
'csp'' set ''value'' ← the value v for ''var'' that minimizes CONFLICTS(''var'',''v'',''current_state'',''csp'')
set ''var'' ← ''value'' in ''current_state''
return ''failure''
Although not specified in the algorithm, a good initial assignment can be critical for quickly approaching a solution. Use a
greedy algorithm
A greedy algorithm is any algorithm that follows the problem-solving heuristic of making the locally optimal choice at each stage. In many problems, a greedy strategy does not produce an optimal solution, but a greedy heuristic can yield locall ...
with some level of randomness and allow variable assignment to break constraints when no other assignment will suffice. The randomness helps min-conflicts avoid local minima created by the greedy algorithm's initial assignment. In fact, Constraint Satisfaction Problems that respond best to a min-conflicts solution do well where a greedy algorithm almost solves the problem.
Map coloring
In cartography, map coloring is the act of choosing colors as a form of map symbol to be used on a map. In mathematics, map coloring is the act of assigning colors to features of a map such that no two adjacent features have the same color using t ...
problems do poorly with Greedy Algorithm as well as Min-Conflicts. Sub areas of the map tend to hold their colors stable and min conflicts cannot hill climb to break out of the local minimum. The function counts the number of constraints violated by a particular object, given that the state of the rest of the assignment is known.
History
Although Artificial Intelligence and
Discrete Optimization
Discrete optimization is a branch of optimization in applied mathematics and computer science.
Scope
As opposed to continuous optimization, some or all of the variables used in a discrete mathematical program are restricted to be discrete var ...
had known and reasoned about Constraint Satisfaction Problems for many years, it was not until the early 1990s that this process for solving large CSPs had been codified in algorithmic form. Early on, Mark Johnston of the
Space Telescope Science Institute
The Space Telescope Science Institute (STScI) is the science operations center for the Hubble Space Telescope (HST), science operations and mission operations center for the James Webb Space Telescope (JWST), and science operations center for the ...
looked for a method to schedule astronomical observations on the
Hubble Space Telescope
The Hubble Space Telescope (often referred to as HST or Hubble) is a space telescope that was launched into low Earth orbit in 1990 and remains in operation. It was not the first space telescope, but it is one of the largest and most ver ...
. In collaboration with Hans-Martin Adorf of the
Space Telescope European Coordinating Facility
right
The Space Telescope – European Coordinating Facility (ST-ECF) was an institution which provided a number of support and service functions primarily for European observers of the NASA/ESA Hubble Space Telescope (HST). It was established in 1 ...
, he created a neural network capable of solving a toy ''n''-queens problem (for 1024 queens). Steven Minton and Andy Philips analyzed the neural network algorithm and separated it into two phases: (1) an initial assignment using a greedy algorithm and (2) a conflict minimization phases (later to be called "min-conflicts"). A paper was written and presented at AAAI-90; Philip Laird provided the mathematical analysis of the algorithm.
Subsequently, Mark Johnston and the STScI staff used min-conflicts to schedule astronomers' observation time on the Hubble Space Telescope.
Example

Min-Conflicts solves the ''N''-Queens Problem by randomly selecting a column from the chess board for queen reassignment. The algorithm searches each potential move for the number of conflicts (number of attacking queens), shown in each square. The algorithm moves the queen to the square with the minimum number of conflicts, breaking ties randomly. Note that the number of conflicts is generated by each new direction that a queen can attack from. If two queens would attack from the same direction (row, or diagonal) then the conflict is only counted once. Also note that if a queen is in a position in which a move would put it in greater conflict than its current position, it does not make a move. It follows that if a queen is in a state of minimum conflict, it does not have to move.
This algorithm's run time for solving ''N''-Queens is independent of problem size. This algorithm will even solve the ''million-queens problem'' on average of 50 steps. This discovery and observations led to a great amount of research in 1990 and began research on local search problems and the distinctions between easy and hard problems. ''N''-Queens is easy for local search because solutions are densely distributed throughout the state space. It is also effective for hard problems. For example, it has been used to schedule observations for the
Hubble Space Telescope
The Hubble Space Telescope (often referred to as HST or Hubble) is a space telescope that was launched into low Earth orbit in 1990 and remains in operation. It was not the first space telescope, but it is one of the largest and most ver ...
, reducing the time taken to schedule a week of observations from three weeks to around 10 minutes.
[Stuart Russell, Peter Norvig, “Artificial Intelligence: A Modern Approach (3rd Edition)”, pp. 220-222, December 11, 2009.]
See also
*
Warnsdorff's algorithm
*
Eight queens Puzzle
*
Guided Local Search
References
{{reflist
*
Stuart J. Russell and
Peter Norvig
Peter Norvig (born December 14, 1956) is an American computer scientist and Distinguished Education Fellow at the Stanford Institute for Human-Centered AI. He previously served as a director of research and search quality at Google. Norvig is ...
, ''
Artificial Intelligence: A Modern Approach''
External links
The min-conflicts heuristic microform : experiment and theoretical results / Steven Minton ...
t al. NASA, Ames Research Center, Artificial Intelligence Research Branch. Distributed to depository libraries in microfiche.
Constraint programming