Motivation Phases Implementation
Artificial Intelligence
Graph theory
G. Guérard
Department of Nouvelles Energies
Ecole Supérieure d’Ingénieurs Léonard de Vinci
Lecture 0
GG | A.I. 1/26
Motivation Phases Implementation
OutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutline
1 Motivation
2 Phases
Information gathering phase
Design phase
Choice phase
3 Implementation
Definition
Implementation
Paradigm
Algorithm’s efficiency
GG | A.I. 2/26
Motivation Phases Implementation
What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?
Motivation
Decision making is a process of choosing among two or more
alternate courses of action for the purpose of attaining a goal (or
goals).
How to choose between production’s strategies ?
How to find a shortest path in a traffic ?
Etc.
GG | A.I. 3/26
Motivation Phases Implementation
Decision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making Phases
Decision making involves three major phases followed by the
validation phase:
Information gathering,
Design,
Choice,
Implementation,
Validation.
To examine and to identify the problem (variables, functions, val-
ues, etc.).
GG | A.I. 4/26
Motivation Phases Implementation
Decision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making Phases
Decision making involves three major phases followed by the
validation phase:
Information gathering,
Design,
Choice,
Implementation,
Validation.
To construct a model that represents the system.
GG | A.I. 4/26
Motivation Phases Implementation
Decision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making Phases
Decision making involves three major phases followed by the
validation phase:
Information gathering,
Design,
Choice,
Implementation,
Validation.
To select a solution to the model.
GG | A.I. 4/26
Motivation Phases Implementation
Decision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making Phases
Decision making involves three major phases followed by the
validation phase:
Information gathering,
Design,
Choice,
Implementation,
Validation.
To implemente an informatic software to solve any instance of the
model.
GG | A.I. 4/26
Motivation Phases Implementation
Decision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making Phases
Decision making involves three major phases followed by the
validation phase:
Information gathering,
Design,
Choice,
Implementation,
Validation.
To validate the software if it shows reasonable computing time and
good solution.
GG | A.I. 4/26
Motivation Phases Implementation
Information gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phase
Information gathering includes several activities aimed at identifying
problem situations or opportunities :
1 Problem identification
2 Problem classification
3 Problem decomposition
Identification of organized goals and objectives related to an issue
of concern.
GG | A.I. 5/26
Motivation Phases Implementation
Information gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phase
Information gathering includes several activities aimed at identifying
problem situations or opportunities :
1 Problem identification
2 Problem classification
3 Problem decomposition
To determine whether a problem exists, identify its symptoms, de-
termine its magnitude, and explicitly define it.
GG | A.I. 5/26
Motivation Phases Implementation
Information gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phase
Information gathering includes several activities aimed at identifying
problem situations or opportunities :
1 Problem identification
2 Problem classification
3 Problem decomposition
Some issues may arise during data collection and estimation like
lack of data, inoccurate or inprecise data, bad estimation, information
overload, only simulated data, etc.
GG | A.I. 5/26
Motivation Phases Implementation
Information gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phase
Information gathering includes several activities aimed at identifying
problem situations or opportunities :
1 Problem identification
2 Problem classification
3 Problem decomposition
Problem classification is the placement of a problem in a definable
category. This leads to a standard solution approach.
GG | A.I. 5/26
Motivation Phases Implementation
Information gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phase
Information gathering includes several activities aimed at identifying
problem situations or opportunities :
1 Problem identification
2 Problem classification
3 Problem decomposition
Many complex problems can be divided into sub-problems.
Some unstructured problems may have some highly structured sub-
problems.
GG | A.I. 5/26
Motivation Phases Implementation
Design phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase
The design phase involves finding and analyzing possible courses
of action :
1 To understand the problem
2 A model is constructed, tested, and validated
Modelling involves abstracting the problem to quantitative and/or
qualitative forms.
GG | A.I. 6/26
Motivation Phases Implementation
Design phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase
The design phase involves finding and analyzing possible courses
of action :
1 To understand the problem
2 A model is constructed, tested, and validated
For a mathematical model, the variables are identified and the rela-
tionships among them are established.
GG | A.I. 6/26
Motivation Phases Implementation
Design phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase
The design phase involves finding and analyzing possible courses
of action :
1 To understand the problem
2 A model is constructed, tested, and validated
All models are made up of three basic components: decision vari-
ables, uncontrollable variables, and result variables. Mathamtical
relationships link these components together.
GG | A.I. 6/26
Motivation Phases Implementation
Design phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase
The design phase involves finding and analyzing possible courses
of action :
1 To understand the problem
2 A model is constructed, tested, and validated
In a non-quantitative model, the relationships are symbolic or quali-
tative.
GG | A.I. 6/26
Motivation Phases Implementation
Design phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase
All models are made up of three basic components :
1 Result variables
2 Decision variables
3 Uncontrollable variables
Result variables are outputs. The reflect the level of effectiveness
of the system. These are dependent variables.
GG | A.I. 7/26
Motivation Phases Implementation
Design phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase
All models are made up of three basic components :
1 Result variables
2 Decision variables
3 Uncontrollable variables
They describe alternative courses of action.
GG | A.I. 7/26
Motivation Phases Implementation
Design phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase
All models are made up of three basic components :
1 Result variables
2 Decision variables
3 Uncontrollable variables
They are factors that affect the result variables but are not under
control of the decision maker. Either these factors are fixed or they
can vary.
GG | A.I. 7/26
Motivation Phases Implementation
Design phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase
Structure of quantitative models
The components are linked together by mathematical
expressions.
Principle of Choice
A principle of choice is a criterion that describes the acceptability
of a solution approach
GG | A.I. 8/26
Motivation Phases Implementation
Design phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase
Normative models
The chosen solution is demonstrably the best of all possible
alternatives. To find it, one should examine all alternatives and
prove that the one selected is indeed the best one. The process is
basically Optimization.
Descriptive models
They investigate alternate courses of action under different
configurations of inputs and processes. All the alternatives are not
checked, only a given set are.
GG | A.I. 9/26
Motivation Phases Implementation
Choice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phase
The choice phase includes:
Recommendation of a solution
Evaluation of a solution
When the problem is solved, a solution is chosen based on the
model. This one is recommended over the set of solutions.
GG | A.I. 10/26
Motivation Phases Implementation
Choice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phase
The choice phase includes:
Recommendation of a solution
Evaluation of a solution
Evaluation is possible if the result variables give a quantitative so-
lution. A preference relation over the set of solution give an order:
f (a) f (b) means that f (b) is better or equal to f (a) where a, b
are variables and f (.) is a mathematical function based on result
variables.
GG | A.I. 10/26
Motivation Phases Implementation
Choice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phase
The choice phase includes:
Recommendation of a solution
Evaluation of a solution
b is the best solution iff: f (x) f (b) for any x in the set of solution.
GG | A.I. 10/26
Motivation Phases Implementation
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithms
An algorithm is a self-contained step-by-step set of operations to be
performed.
An algorithm is an effective method that can be expressed within
a finite amount of space and time and in a well-defined formal
language for calculating a function. Starting from an initial state
and initial input (perhaps empty), the instructions describe a
computation that, when executed, proceeds through a finite number
of well-defined successive states, eventually producing output and
terminating at a final ending state. The transition from one state
to the next is not necessarily deterministic; some algorithms, known
as randomized algorithms, incorporate random input.
GG | A.I. 11/26
Motivation Phases Implementation
FlowchartFlowchartFlowchartFlowchartFlowchartFlowchartFlowchartFlowchartFlowchartFlowchartFlowchartFlowchartFlowchartFlowchartFlowchartFlowchartFlowchart
GG | A.I. 12/26
Motivation Phases Implementation
PseudocodePseudocodePseudocodePseudocodePseudocodePseudocodePseudocodePseudocodePseudocodePseudocodePseudocodePseudocodePseudocodePseudocodePseudocodePseudocodePseudocode
GG | A.I. 13/26
Motivation Phases Implementation
Classification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementation
1 Classic, iterative implementation
2 Recursion
3 Logical
4 Deterministic or non-deterministic
5 Exact or approximate
6 Serial, parallel or distributed
Iterative algorithms use repetitive constructs like loops and some-
times additional data structures like stacks to solve the given prob-
lems.
GG | A.I. 14/26
Motivation Phases Implementation
Classification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementation
1 Classic, iterative implementation
2 Recursion
3 Logical
4 Deterministic or non-deterministic
5 Exact or approximate
6 Serial, parallel or distributed
A recursive algorithm is one that makes reference to itself repeat-
edly until a termination condition matches.
GG | A.I. 14/26
Motivation Phases Implementation
Classification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementation
1 Classic, iterative implementation
2 Recursion
3 Logical
4 Deterministic or non-deterministic
5 Exact or approximate
6 Serial, parallel or distributed
A logical algorithm is composed by logic component and control
component.
GG | A.I. 14/26
Motivation Phases Implementation
Classification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementation
1 Classic, iterative implementation
2 Recursion
3 Logical
4 Deterministic or non-deterministic
5 Exact or approximate
6 Serial, parallel or distributed
Deterministic algorithms solve the problem with exact decision at
every step of the algorithm whereas non-deterministic algorithms
solve problems via guessing. A deterministic algorithm is an algo-
rithm which, given a particular input, will always produce the same
output.
GG | A.I. 14/26
Motivation Phases Implementation
Classification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementation
1 Classic, iterative implementation
2 Recursion
3 Logical
4 Deterministic or non-deterministic
5 Exact or approximate
6 Serial, parallel or distributed
While many algorithms reach an exact solution, approximation algo-
rithms seek an approximation that is close to the true solution.
When it is not possible to find a best solution in human time, one
can seek for an approximate solution by less complex algorithms.
GG | A.I. 14/26
Motivation Phases Implementation
Classification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementation
1 Classic, iterative implementation
2 Recursion
3 Logical
4 Deterministic or non-deterministic
5 Exact or approximate
6 Serial, parallel or distributed
Those implementations depend of computer architectures, i.e. num-
ber of processors that can work on a problem at the same time, and
how to decompose the whole process into independent processes.
GG | A.I. 14/26
Motivation Phases Implementation
RecursionRecursionRecursionRecursionRecursionRecursionRecursionRecursionRecursionRecursionRecursionRecursionRecursionRecursionRecursionRecursionRecursion
A recursive algorithm is one that makes reference to itself
repeatedly until a termination condition matches.
GG | A.I. 15/26
Motivation Phases Implementation
LogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogical
A logical algorithm is composed by logic component and
control component.
The logic component expresses the axioms that may be used in the
computation and the control component determines the way in
which deduction is applied to the axioms. This is the basis for the
logic programming paradigm. In pure logic programming languages
the control component is fixed and algorithms are specified by
supplying only the logic component.
GG | A.I. 16/26
Motivation Phases Implementation
Logical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prolog
Basics: man(adam). man(peter). man(paul). woman(marry).
woman(eve).
parent(adam,peter). parent(eve,peter). parent(adam,paul).
parent(marry,paul).
Controls: father(F,C):-man(F),parent(F,C).
mother(M,C):-woman(M),parent(M,C). is_father(F):-father(F,_).
is_mother(M):-mother(M,_).
Question: ?-is_father(adam).
GG | A.I. 17/26
Motivation Phases Implementation
Classification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigm
1 Brute-force
2 Divide and conquer
3 Dynamic programming
4 Search
5 Randomized
6 Reduction
Naive algorithms try every possible solution to see which is best.
GG | A.I. 18/26
Motivation Phases Implementation
Classification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigm
1 Brute-force
2 Divide and conquer
3 Dynamic programming
4 Search
5 Randomized
6 Reduction
A divide and conquer algorithm repeatedly reduces an instance of
a problem to one or more smaller instances of the same problem until
the instances are small enough to solve easily.
GG | A.I. 18/26
Motivation Phases Implementation
Classification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigm
1 Brute-force
2 Divide and conquer
3 Dynamic programming
4 Search
5 Randomized
6 Reduction
A problem that can be solved optimally by breaking it into sub-
problems and then recursively finding the optimal solutions to the
sub-problems is said to have optimal substructure.
GG | A.I. 18/26
Motivation Phases Implementation
Classification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigm
1 Brute-force
2 Divide and conquer
3 Dynamic programming
4 Search
5 Randomized
6 Reduction
Many problems can be modeled as problems on graphs. A graph
exploration algorithm specifies rules for moving around a graph and
is useful for such problems.
GG | A.I. 18/26
Motivation Phases Implementation
Classification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigm
1 Brute-force
2 Divide and conquer
3 Dynamic programming
4 Search
5 Randomized
6 Reduction
Such algorithms make some choices randomly. They can be very
useful in finding approximate solutions for problems where finding
exact solutions can be impractical.
GG | A.I. 18/26
Motivation Phases Implementation
Classification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigm
1 Brute-force
2 Divide and conquer
3 Dynamic programming
4 Search
5 Randomized
6 Reduction
This technique involves solving a difficult problem by transforming
it into a better known problem for which we have optimal algo-
rithms. The goal is to find a reducing algorithm whose complexity is
not dominated by the resulting reduced algorithm’s.
GG | A.I. 18/26
Motivation Phases Implementation
Divide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquer
GG | A.I. 19/26
Motivation Phases Implementation
Dynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programming
The longest common subsequence (LCS) problem is the problem of
finding the longest subsequence common to all sequences in a set
of sequences.
LCS (Xi ,Yj ) =



if i = 0 or j = 0
LCS (Xi−1,Yj−1) xi if xi = yj
longest(LCS (Xi ,Yj−1),LCS (Xi−1,Yj )) if xi = yj
GG | A.I. 20/26
Motivation Phases Implementation
ReductionReductionReductionReductionReductionReductionReductionReductionReductionReductionReductionReductionReductionReductionReductionReductionReduction
We tranform a bipartite matching problem into a flow problem :
GG | A.I. 21/26
Motivation Phases Implementation
BasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasics
Termination
To determine whether the evaluation of a given program will
definitely terminate
Correctness
An input give a solution of the problem.
Completeness
For a feasible domain, the algorithm give a solution.
GG | A.I. 22/26
Motivation Phases Implementation
ExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExample
Termination: in all condition, the algorithm returns a value.
Correctness: for an input n, the algorithm returns a factorial.
Completeness: n is an integer.
GG | A.I. 23/26
Motivation Phases Implementation
ComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexity
The best, worst and average case complexity refer to three different ways of
measuring the time complexity (or any other complexity measure) of different inputs
of the same size. Since some inputs of size n may be faster to solve than others, we
define the following complexities:
Best-case complexity
This is the complexity of solving the problem for the best input of size n.
Worst-case complexity
This is the complexity of solving the problem for the worst input of size n.
Average-case complexity
This is the complexity of solving the problem on an average. This complexity is only
defined with respect to a probability distribution over the inputs. For instance, if all
inputs of the same size are assumed to be equally likely to appear, the average case
complexity can be defined with respect to the uniform distribution over all inputs of
size n.
GG | A.I. 24/26
Motivation Phases Implementation
Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)
Notation Examples
O(1) Constant: condition, elementary computing
O(log(n)) Logarithm: tree, binary search
O(n) Linear: for, while, etc.
O(n ∗log(n)) Quasilinear: quicksort, mergesort, tree search
O(n²) Quadratic: multiplying two n-digit numbers, sort, matrix
O(np) Polynomial: grammar, matching, reduction
O(2n) Exponential: brute-force, search tree
O(pn) Exponential: dynamic programming, logical brute-force
O(n!) Factorial: naive combinatory algorithm
GG | A.I. 25/26
Motivation Phases Implementation
ExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExample
Bubble sort: sort an array of n numbers by switching two
following indexes.
The best time complexity is when the algorithm do one loop:
O(n).
The worst time complexity is when the algorithm do n loop:
O(n2).
In average, the algorithm is quadratric: O(n2).
Data are stored in an array, data are reached directly by a
reference in memory. Data complexity is: O(1).
GG | A.I. 26/26

Basics on Decision Making

  • 1.
    Motivation Phases Implementation ArtificialIntelligence Graph theory G. Guérard Department of Nouvelles Energies Ecole Supérieure d’Ingénieurs Léonard de Vinci Lecture 0 GG | A.I. 1/26
  • 2.
    Motivation Phases Implementation OutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutlineOutline 1Motivation 2 Phases Information gathering phase Design phase Choice phase 3 Implementation Definition Implementation Paradigm Algorithm’s efficiency GG | A.I. 2/26
  • 3.
    Motivation Phases Implementation Whatis decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ?What is decision making ? Motivation Decision making is a process of choosing among two or more alternate courses of action for the purpose of attaining a goal (or goals). How to choose between production’s strategies ? How to find a shortest path in a traffic ? Etc. GG | A.I. 3/26
  • 4.
    Motivation Phases Implementation DecisionMaking PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making Phases Decision making involves three major phases followed by the validation phase: Information gathering, Design, Choice, Implementation, Validation. To examine and to identify the problem (variables, functions, val- ues, etc.). GG | A.I. 4/26
  • 5.
    Motivation Phases Implementation DecisionMaking PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making Phases Decision making involves three major phases followed by the validation phase: Information gathering, Design, Choice, Implementation, Validation. To construct a model that represents the system. GG | A.I. 4/26
  • 6.
    Motivation Phases Implementation DecisionMaking PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making Phases Decision making involves three major phases followed by the validation phase: Information gathering, Design, Choice, Implementation, Validation. To select a solution to the model. GG | A.I. 4/26
  • 7.
    Motivation Phases Implementation DecisionMaking PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making Phases Decision making involves three major phases followed by the validation phase: Information gathering, Design, Choice, Implementation, Validation. To implemente an informatic software to solve any instance of the model. GG | A.I. 4/26
  • 8.
    Motivation Phases Implementation DecisionMaking PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making PhasesDecision Making Phases Decision making involves three major phases followed by the validation phase: Information gathering, Design, Choice, Implementation, Validation. To validate the software if it shows reasonable computing time and good solution. GG | A.I. 4/26
  • 9.
    Motivation Phases Implementation Informationgathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phase Information gathering includes several activities aimed at identifying problem situations or opportunities : 1 Problem identification 2 Problem classification 3 Problem decomposition Identification of organized goals and objectives related to an issue of concern. GG | A.I. 5/26
  • 10.
    Motivation Phases Implementation Informationgathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phase Information gathering includes several activities aimed at identifying problem situations or opportunities : 1 Problem identification 2 Problem classification 3 Problem decomposition To determine whether a problem exists, identify its symptoms, de- termine its magnitude, and explicitly define it. GG | A.I. 5/26
  • 11.
    Motivation Phases Implementation Informationgathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phase Information gathering includes several activities aimed at identifying problem situations or opportunities : 1 Problem identification 2 Problem classification 3 Problem decomposition Some issues may arise during data collection and estimation like lack of data, inoccurate or inprecise data, bad estimation, information overload, only simulated data, etc. GG | A.I. 5/26
  • 12.
    Motivation Phases Implementation Informationgathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phase Information gathering includes several activities aimed at identifying problem situations or opportunities : 1 Problem identification 2 Problem classification 3 Problem decomposition Problem classification is the placement of a problem in a definable category. This leads to a standard solution approach. GG | A.I. 5/26
  • 13.
    Motivation Phases Implementation Informationgathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phaseInformation gathering phase Information gathering includes several activities aimed at identifying problem situations or opportunities : 1 Problem identification 2 Problem classification 3 Problem decomposition Many complex problems can be divided into sub-problems. Some unstructured problems may have some highly structured sub- problems. GG | A.I. 5/26
  • 14.
    Motivation Phases Implementation DesignphaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase The design phase involves finding and analyzing possible courses of action : 1 To understand the problem 2 A model is constructed, tested, and validated Modelling involves abstracting the problem to quantitative and/or qualitative forms. GG | A.I. 6/26
  • 15.
    Motivation Phases Implementation DesignphaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase The design phase involves finding and analyzing possible courses of action : 1 To understand the problem 2 A model is constructed, tested, and validated For a mathematical model, the variables are identified and the rela- tionships among them are established. GG | A.I. 6/26
  • 16.
    Motivation Phases Implementation DesignphaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase The design phase involves finding and analyzing possible courses of action : 1 To understand the problem 2 A model is constructed, tested, and validated All models are made up of three basic components: decision vari- ables, uncontrollable variables, and result variables. Mathamtical relationships link these components together. GG | A.I. 6/26
  • 17.
    Motivation Phases Implementation DesignphaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase The design phase involves finding and analyzing possible courses of action : 1 To understand the problem 2 A model is constructed, tested, and validated In a non-quantitative model, the relationships are symbolic or quali- tative. GG | A.I. 6/26
  • 18.
    Motivation Phases Implementation DesignphaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase All models are made up of three basic components : 1 Result variables 2 Decision variables 3 Uncontrollable variables Result variables are outputs. The reflect the level of effectiveness of the system. These are dependent variables. GG | A.I. 7/26
  • 19.
    Motivation Phases Implementation DesignphaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase All models are made up of three basic components : 1 Result variables 2 Decision variables 3 Uncontrollable variables They describe alternative courses of action. GG | A.I. 7/26
  • 20.
    Motivation Phases Implementation DesignphaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase All models are made up of three basic components : 1 Result variables 2 Decision variables 3 Uncontrollable variables They are factors that affect the result variables but are not under control of the decision maker. Either these factors are fixed or they can vary. GG | A.I. 7/26
  • 21.
    Motivation Phases Implementation DesignphaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase Structure of quantitative models The components are linked together by mathematical expressions. Principle of Choice A principle of choice is a criterion that describes the acceptability of a solution approach GG | A.I. 8/26
  • 22.
    Motivation Phases Implementation DesignphaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phaseDesign phase Normative models The chosen solution is demonstrably the best of all possible alternatives. To find it, one should examine all alternatives and prove that the one selected is indeed the best one. The process is basically Optimization. Descriptive models They investigate alternate courses of action under different configurations of inputs and processes. All the alternatives are not checked, only a given set are. GG | A.I. 9/26
  • 23.
    Motivation Phases Implementation ChoicephaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phase The choice phase includes: Recommendation of a solution Evaluation of a solution When the problem is solved, a solution is chosen based on the model. This one is recommended over the set of solutions. GG | A.I. 10/26
  • 24.
    Motivation Phases Implementation ChoicephaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phase The choice phase includes: Recommendation of a solution Evaluation of a solution Evaluation is possible if the result variables give a quantitative so- lution. A preference relation over the set of solution give an order: f (a) f (b) means that f (b) is better or equal to f (a) where a, b are variables and f (.) is a mathematical function based on result variables. GG | A.I. 10/26
  • 25.
    Motivation Phases Implementation ChoicephaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phaseChoice phase The choice phase includes: Recommendation of a solution Evaluation of a solution b is the best solution iff: f (x) f (b) for any x in the set of solution. GG | A.I. 10/26
  • 26.
    Motivation Phases Implementation AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithms Analgorithm is a self-contained step-by-step set of operations to be performed. An algorithm is an effective method that can be expressed within a finite amount of space and time and in a well-defined formal language for calculating a function. Starting from an initial state and initial input (perhaps empty), the instructions describe a computation that, when executed, proceeds through a finite number of well-defined successive states, eventually producing output and terminating at a final ending state. The transition from one state to the next is not necessarily deterministic; some algorithms, known as randomized algorithms, incorporate random input. GG | A.I. 11/26
  • 27.
  • 28.
  • 29.
    Motivation Phases Implementation Classificationby implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementation 1 Classic, iterative implementation 2 Recursion 3 Logical 4 Deterministic or non-deterministic 5 Exact or approximate 6 Serial, parallel or distributed Iterative algorithms use repetitive constructs like loops and some- times additional data structures like stacks to solve the given prob- lems. GG | A.I. 14/26
  • 30.
    Motivation Phases Implementation Classificationby implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementation 1 Classic, iterative implementation 2 Recursion 3 Logical 4 Deterministic or non-deterministic 5 Exact or approximate 6 Serial, parallel or distributed A recursive algorithm is one that makes reference to itself repeat- edly until a termination condition matches. GG | A.I. 14/26
  • 31.
    Motivation Phases Implementation Classificationby implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementation 1 Classic, iterative implementation 2 Recursion 3 Logical 4 Deterministic or non-deterministic 5 Exact or approximate 6 Serial, parallel or distributed A logical algorithm is composed by logic component and control component. GG | A.I. 14/26
  • 32.
    Motivation Phases Implementation Classificationby implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementation 1 Classic, iterative implementation 2 Recursion 3 Logical 4 Deterministic or non-deterministic 5 Exact or approximate 6 Serial, parallel or distributed Deterministic algorithms solve the problem with exact decision at every step of the algorithm whereas non-deterministic algorithms solve problems via guessing. A deterministic algorithm is an algo- rithm which, given a particular input, will always produce the same output. GG | A.I. 14/26
  • 33.
    Motivation Phases Implementation Classificationby implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementation 1 Classic, iterative implementation 2 Recursion 3 Logical 4 Deterministic or non-deterministic 5 Exact or approximate 6 Serial, parallel or distributed While many algorithms reach an exact solution, approximation algo- rithms seek an approximation that is close to the true solution. When it is not possible to find a best solution in human time, one can seek for an approximate solution by less complex algorithms. GG | A.I. 14/26
  • 34.
    Motivation Phases Implementation Classificationby implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementationClassification by implementation 1 Classic, iterative implementation 2 Recursion 3 Logical 4 Deterministic or non-deterministic 5 Exact or approximate 6 Serial, parallel or distributed Those implementations depend of computer architectures, i.e. num- ber of processors that can work on a problem at the same time, and how to decompose the whole process into independent processes. GG | A.I. 14/26
  • 35.
  • 36.
    Motivation Phases Implementation LogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogicalLogical Alogical algorithm is composed by logic component and control component. The logic component expresses the axioms that may be used in the computation and the control component determines the way in which deduction is applied to the axioms. This is the basis for the logic programming paradigm. In pure logic programming languages the control component is fixed and algorithms are specified by supplying only the logic component. GG | A.I. 16/26
  • 37.
    Motivation Phases Implementation Logical:prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prologLogical: prolog Basics: man(adam). man(peter). man(paul). woman(marry). woman(eve). parent(adam,peter). parent(eve,peter). parent(adam,paul). parent(marry,paul). Controls: father(F,C):-man(F),parent(F,C). mother(M,C):-woman(M),parent(M,C). is_father(F):-father(F,_). is_mother(M):-mother(M,_). Question: ?-is_father(adam). GG | A.I. 17/26
  • 38.
    Motivation Phases Implementation Classificationby paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigm 1 Brute-force 2 Divide and conquer 3 Dynamic programming 4 Search 5 Randomized 6 Reduction Naive algorithms try every possible solution to see which is best. GG | A.I. 18/26
  • 39.
    Motivation Phases Implementation Classificationby paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigm 1 Brute-force 2 Divide and conquer 3 Dynamic programming 4 Search 5 Randomized 6 Reduction A divide and conquer algorithm repeatedly reduces an instance of a problem to one or more smaller instances of the same problem until the instances are small enough to solve easily. GG | A.I. 18/26
  • 40.
    Motivation Phases Implementation Classificationby paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigm 1 Brute-force 2 Divide and conquer 3 Dynamic programming 4 Search 5 Randomized 6 Reduction A problem that can be solved optimally by breaking it into sub- problems and then recursively finding the optimal solutions to the sub-problems is said to have optimal substructure. GG | A.I. 18/26
  • 41.
    Motivation Phases Implementation Classificationby paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigm 1 Brute-force 2 Divide and conquer 3 Dynamic programming 4 Search 5 Randomized 6 Reduction Many problems can be modeled as problems on graphs. A graph exploration algorithm specifies rules for moving around a graph and is useful for such problems. GG | A.I. 18/26
  • 42.
    Motivation Phases Implementation Classificationby paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigm 1 Brute-force 2 Divide and conquer 3 Dynamic programming 4 Search 5 Randomized 6 Reduction Such algorithms make some choices randomly. They can be very useful in finding approximate solutions for problems where finding exact solutions can be impractical. GG | A.I. 18/26
  • 43.
    Motivation Phases Implementation Classificationby paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigmClassification by paradigm 1 Brute-force 2 Divide and conquer 3 Dynamic programming 4 Search 5 Randomized 6 Reduction This technique involves solving a difficult problem by transforming it into a better known problem for which we have optimal algo- rithms. The goal is to find a reducing algorithm whose complexity is not dominated by the resulting reduced algorithm’s. GG | A.I. 18/26
  • 44.
    Motivation Phases Implementation Divideand conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquerDivide and conquer GG | A.I. 19/26
  • 45.
    Motivation Phases Implementation DynamicprogrammingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programmingDynamic programming The longest common subsequence (LCS) problem is the problem of finding the longest subsequence common to all sequences in a set of sequences. LCS (Xi ,Yj ) =    if i = 0 or j = 0 LCS (Xi−1,Yj−1) xi if xi = yj longest(LCS (Xi ,Yj−1),LCS (Xi−1,Yj )) if xi = yj GG | A.I. 20/26
  • 46.
  • 47.
    Motivation Phases Implementation BasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasicsBasics Termination Todetermine whether the evaluation of a given program will definitely terminate Correctness An input give a solution of the problem. Completeness For a feasible domain, the algorithm give a solution. GG | A.I. 22/26
  • 48.
    Motivation Phases Implementation ExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExample Termination:in all condition, the algorithm returns a value. Correctness: for an input n, the algorithm returns a factorial. Completeness: n is an integer. GG | A.I. 23/26
  • 49.
    Motivation Phases Implementation ComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexityComplexity Thebest, worst and average case complexity refer to three different ways of measuring the time complexity (or any other complexity measure) of different inputs of the same size. Since some inputs of size n may be faster to solve than others, we define the following complexities: Best-case complexity This is the complexity of solving the problem for the best input of size n. Worst-case complexity This is the complexity of solving the problem for the worst input of size n. Average-case complexity This is the complexity of solving the problem on an average. This complexity is only defined with respect to a probability distribution over the inputs. For instance, if all inputs of the same size are assumed to be equally likely to appear, the average case complexity can be defined with respect to the uniform distribution over all inputs of size n. GG | A.I. 24/26
  • 50.
    Motivation Phases Implementation Complexity(time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time)Complexity (time) Notation Examples O(1) Constant: condition, elementary computing O(log(n)) Logarithm: tree, binary search O(n) Linear: for, while, etc. O(n ∗log(n)) Quasilinear: quicksort, mergesort, tree search O(n²) Quadratic: multiplying two n-digit numbers, sort, matrix O(np) Polynomial: grammar, matching, reduction O(2n) Exponential: brute-force, search tree O(pn) Exponential: dynamic programming, logical brute-force O(n!) Factorial: naive combinatory algorithm GG | A.I. 25/26
  • 51.
    Motivation Phases Implementation ExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExample Bubblesort: sort an array of n numbers by switching two following indexes. The best time complexity is when the algorithm do one loop: O(n). The worst time complexity is when the algorithm do n loop: O(n2). In average, the algorithm is quadratric: O(n2). Data are stored in an array, data are reached directly by a reference in memory. Data complexity is: O(1). GG | A.I. 26/26