Jump to content

Min-conflicts algorithm

From Wikipedia, the free encyclopedia

This is the current revision of this page, as edited by Codeedog (talk | contribs) at 15:37, 4 September 2024 (spelling error). The present address (URL) is a permanent link to this version.

(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

In computer science, a min-conflicts algorithm is a search algorithm or heuristic method to solve constraint satisfaction problems.

One such algorithm is min-conflicts hill-climbing.[1] Given an initial assignment of values to all the variables of a constraint satisfaction problem (with one or more constraints not satisfied), select a variable from the set of variables with conflicts violating one or more of its constraints. Assign to this variable a value that minimizes the number of conflicts (usually breaking ties randomly). Repeat this process of conflicted variable selection and min-conflict value assignment until a solution is found or a pre-selected maximum number of iterations is reached. If a solution is not found the algorithm can be restarted with a different initial assignment.

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[2] that chooses the state with the minimum number of conflicts.

Algorithm

[edit]
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 varvalue 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 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 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 CONFLICTS function counts the number of constraints violated by a particular object, given that the state of the rest of the assignment is known.

History

[edit]

Although Artificial Intelligence and Discrete Optimization 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 looked for a method to schedule astronomical observations on the Hubble Space Telescope. In collaboration with Hans-Martin Adorf of the Space Telescope European Coordinating Facility, he created a neural network capable of solving a toy n-queens problem (for 1024 queens).[3][4] 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

[edit]
Animation of min-conflicts resolution of 8-queens. First stage assigns columns greedily minimizing conflicts, then solves

Min-Conflicts solves the N-Queens Problem by 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 performance depends greatly on the choice of starting position. A good starting position can be generated by assigning queens column by column with each assignment being to a row that minimizes the number of constraint violations. This results in a starting position with an average number of constraint violations that is surprisingly small and grows very slowly with n (e.g. 12.8 for n=106).

Given a good starting position, the number of reassignments required for a solution is similarly constant: this algorithm will even solve the million-queens problem in approximately 50 reassignments. The number of constraint evaluations for each reassignment grows with n leading to nearly linear run-time.

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, reducing the time taken to schedule a week of observations from three weeks to around 10 minutes.[5]

See also

[edit]

References

[edit]
  1. ^ Minton, Steven; Mark D. Johnston; Andrew B. Philips; Philip Laird (1990). "Solving Large-Scale Constraint Satisfaction and Scheduling Problems Using a Heuristic Repair Method" (PDF). Eighth National Conference on Artificial Intelligence (AAAI-90), Boston, Massachusetts: 17–24. Retrieved 27 March 2013.
  2. ^ Minton, Steven; Mark D. Johnston; Andrew B. Philips; Philip Laird (1992). "Minimizing conflicts: a heuristic repair method for constraint satisfaction and scheduling problems" (PDF). Artificial Intelligence. 58 (1): 161–205. CiteSeerX 10.1.1.308.6637. doi:10.1016/0004-3702(92)90007-k. S2CID 14830518. Retrieved 27 March 2013.
  3. ^ Johnston, M. D.; Adorf, H.-M. (1989). "Learning in Stochastic Neural Networks for Constraint Satisfaction Problems". NASA Conf. On Space Telerobotics 1989, Pasadena, CA; G. Rodriguez, H. Seraji (Eds.): 367–376 vol.II.
  4. ^ Adorf, H.-M.; Johnston, M. D. (1990). "A discrete stochastic neural network algorithm for constraint satisfaction problems". 1990 IJCNN International Joint Conference on Neural Networks. pp. 917–924 vol.3. doi:10.1109/IJCNN.1990.137951. S2CID 26917432.
  5. ^ Stuart Russell, Peter Norvig, “Artificial Intelligence: A Modern Approach (3rd Edition)”, pp. 220-222, December 11, 2009.
[edit]
  • [1] The min-conflicts heuristic microform : experiment and theoretical results / Steven Minton ... [et al.]. NASA, Ames Research Center, Artificial Intelligence Research Branch. Distributed to depository libraries in microfiche.