Some reflowing of paragraphs
This commit is contained in:
parent
bc7d05cc2d
commit
3edf8638bd
@ -2,8 +2,8 @@
|
|||||||
\chapter{Background}\label{ch:background}
|
\chapter{Background}\label{ch:background}
|
||||||
%************************************************
|
%************************************************
|
||||||
|
|
||||||
A goal shared between all programming languages is to provide a certain level of
|
A goal shared between all programming languages is to provide a certain level
|
||||||
abstraction: an assembly language allows you to abstract from the binary
|
of abstraction: an assembly language allows you to abstract from the binary
|
||||||
instructions and memory positions; Low-level imperial languages, like FORTRAN,
|
instructions and memory positions; Low-level imperial languages, like FORTRAN,
|
||||||
were the first to allow you to abstract from the processor architecture of the
|
were the first to allow you to abstract from the processor architecture of the
|
||||||
target machine; and nowadays writing a program requires little knowledge of the
|
target machine; and nowadays writing a program requires little knowledge of the
|
||||||
@ -11,21 +11,22 @@ actual workings of the hardware on which the program is executed.
|
|||||||
|
|
||||||
Freuder states that the ``Holy Grail'' of programming languages would be where
|
Freuder states that the ``Holy Grail'' of programming languages would be where
|
||||||
the user merely states the problem, and the computer solves it and that
|
the user merely states the problem, and the computer solves it and that
|
||||||
\gls{constraint-modelling} is one of the biggest steps towards this goal to this
|
\gls{constraint-modelling} is one of the biggest steps towards this goal to
|
||||||
day \autocite*{freuder-1997-holygrail}. Different from imperative (and even
|
this day \autocite*{freuder-1997-holygrail}. Different from imperative (and
|
||||||
other declarative) languages, in a \cml{} the modeller does not describe how to
|
even other declarative) languages, in a \cml{} the modeller does not describe
|
||||||
solve the problem, but rather provides the problem requirements. You could say
|
how to solve the problem, but rather provides the problem requirements. You
|
||||||
that a constraint model actually describes the solution to the problem.
|
could say that a constraint model actually describes the solution to the
|
||||||
|
problem.
|
||||||
|
|
||||||
In a constraint model, instead of specifying the manner in which we can find the
|
In a constraint model, instead of specifying the manner in which we can find
|
||||||
solution, we give a concise description of the problem. We describe what we
|
the solution, we give a concise description of the problem. We describe what we
|
||||||
already know, the \parameters{}, what we wish to know, the \variables{}, and the
|
already know, the \parameters{}, what we wish to know, the \variables{}, and
|
||||||
relationships that should exist between them, the \constraints{}.
|
the relationships that should exist between them, the \constraints{}.
|
||||||
|
|
||||||
This type of combinatorial problem is typically called a \gls{csp}. The goal of
|
This type of combinatorial problem is typically called a \gls{csp}. The goal of
|
||||||
a \gls{csp} is to find values for the \variables{} that satisfy the
|
a \gls{csp} is to find values for the \variables{} that satisfy the
|
||||||
\constraints{} or prove that no such assignment exists. Many \cmls\ also support
|
\constraints{} or prove that no such assignment exists. Many \cmls\ also
|
||||||
the modelling of \gls{cop}, where a \gls{csp} is augmented with a
|
support the modelling of \gls{cop}, where a \gls{csp} is augmented with a
|
||||||
\gls{objective} \(z\). In this case the goal is to find a solution that
|
\gls{objective} \(z\). In this case the goal is to find a solution that
|
||||||
satisfies all \constraints{} while minimising (or maximising) \(z\).
|
satisfies all \constraints{} while minimising (or maximising) \(z\).
|
||||||
|
|
||||||
@ -37,12 +38,12 @@ requirements of the model.
|
|||||||
\begin{example}%
|
\begin{example}%
|
||||||
\label{ex:back-knapsack}
|
\label{ex:back-knapsack}
|
||||||
|
|
||||||
Let us consider the following scenario: Packing for a weekend trip, I have to
|
Let us consider the following scenario: Packing for a weekend trip, I have to
|
||||||
decide which toys to bring for my dog, Audrey. We only have a small amount of
|
decide which toys to bring for my dog, Audrey. We only have a small amount of
|
||||||
space left in the car, so we cannot bring all the toys. Since Audrey gets enjoys
|
space left in the car, so we cannot bring all the toys. Since Audrey gets
|
||||||
playing with some toys more than others, we can now try and pick the toys that
|
enjoys playing with some toys more than others, we can now try and pick the
|
||||||
bring Audrey the most amount of joy, but still fit in the car. The following set
|
toys that bring Audrey the most amount of joy, but still fit in the car. The
|
||||||
of equations describe this knapsack problem as a \gls{cop}:
|
following set of equations describe this knapsack problem as a \gls{cop}:
|
||||||
|
|
||||||
\begin{equation*}
|
\begin{equation*}
|
||||||
\text{maximise}~z~\text{subject to}~
|
\text{maximise}~z~\text{subject to}~
|
||||||
@ -53,22 +54,22 @@ requirements of the model.
|
|||||||
\end{cases}
|
\end{cases}
|
||||||
\end{equation*}
|
\end{equation*}
|
||||||
|
|
||||||
In these equations \(S\) is set \variable{}. It contains the selection of toys
|
In these equations \(S\) is set \variable{}. It contains the selection of
|
||||||
that will be packed for the trip. \(z\) is the objective \variable{} that is
|
toys that will be packed for the trip. \(z\) is the objective \variable{}
|
||||||
maximised to find the optimal selections of toys to pack. The \parameter{}
|
that is maximised to find the optimal selections of toys to pack. The
|
||||||
\(T\) is the set of all the toys. The \(joy\) and \(space\) functions are
|
\parameter{} \(T\) is the set of all the toys. The \(joy\) and \(space\)
|
||||||
\parameters{} used to map toys, \( t \in T\), to a value depicting the amount
|
functions are \parameters{} used to map toys, \( t \in T\), to a value
|
||||||
of enjoyment and space required respectively. Finally, the \parameter{} \(C\)
|
depicting the amount of enjoyment and space required respectively. Finally,
|
||||||
is that depicts the total space that is left in the car before packing the
|
the \parameter{} \(C\) is that depicts the total space that is left in the
|
||||||
toys.
|
car before packing the toys.
|
||||||
|
|
||||||
This constraint model gives an abstract mathematical definition of the
|
This constraint model gives an abstract mathematical definition of the
|
||||||
\gls{cop} that would be easy to adjust to changes in the requirements. To
|
\gls{cop} that would be easy to adjust to changes in the requirements. To
|
||||||
solve instances of this problem, however, these instances have to be
|
solve instances of this problem, however, these instances have to be
|
||||||
transformed into input accepted by a \solver{}. \cmls{} are designed to allow
|
transformed into input accepted by a \solver{}. \cmls{} are designed to allow
|
||||||
the modeller to express combinatorial problems similar to the above
|
the modeller to express combinatorial problems similar to the above
|
||||||
mathematical definition and generate a definition that can be used by
|
mathematical definition and generate a definition that can be used by
|
||||||
dedicated solvers.
|
dedicated solvers.
|
||||||
|
|
||||||
\end{example}
|
\end{example}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user