From 34b043a48cc738ed678e5b88bd089d97d43d547e Mon Sep 17 00:00:00 2001 From: Jonas Sonn Jorgensen Date: Fri, 11 Dec 2020 17:14:03 +0100 Subject: [PATCH 1/7] Giving direction on where to find the Romania Map. Would be better if we add figure number. But I'm waiting for the book to arrive. --- .../3-Solving-Problems-By-Searching/exercises/ex_5/question.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markdown/3-Solving-Problems-By-Searching/exercises/ex_5/question.md b/markdown/3-Solving-Problems-By-Searching/exercises/ex_5/question.md index 5c9b3c6a4d..e3288640fa 100644 --- a/markdown/3-Solving-Problems-By-Searching/exercises/ex_5/question.md +++ b/markdown/3-Solving-Problems-By-Searching/exercises/ex_5/question.md @@ -1,7 +1,7 @@ Suppose two friends live in different cities on -a map, such as the Romania map shown in . On every turn, we can +a map, such as the Romania map shown in chapter 3. On every turn, we can simultaneously move each friend to a neighboring city on the map. The amount of time needed to move from city $i$ to neighbor $j$ is equal to the road distance $d(i,j)$ between the cities, but on each turn the From a4d289978a097dfa6bcfd726c347458b853a0a33 Mon Sep 17 00:00:00 2001 From: Jonas Sonn Jorgensen Date: Sat, 12 Dec 2020 21:02:40 +0100 Subject: [PATCH 2/7] Question typo correction and answers for exercises 3-5 --- .../exercises/ex_3/answers/answer.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 markdown/3-Solving-Problems-By-Searching/exercises/ex_3/answers/answer.md diff --git a/markdown/3-Solving-Problems-By-Searching/exercises/ex_3/answers/answer.md b/markdown/3-Solving-Problems-By-Searching/exercises/ex_3/answers/answer.md new file mode 100644 index 0000000000..86031c61da --- /dev/null +++ b/markdown/3-Solving-Problems-By-Searching/exercises/ex_3/answers/answer.md @@ -0,0 +1,77 @@ +If we want to give a complete problem formulation of a problem we need to remember what a problem formulation consist of (from section 3.1): + +“PROBLEM FORMULATION: The agent devises a description of the states and actions +necessary to reach the goal—an abstract model of the relevant part of the world…” + +Section 3.1.1 describes more in depth what is required to define a search problem. We want a state space, an initial state, a set of goal states, a set of actions, a transition model and an action cost function. + +As stated in section 3.1.2 we should formulate a problem with the right level of abstraction, so that we only have the important details. + + +1. There are six glass boxes in a row, each with a lock. Each of the first five boxes holds a key unlocking the next box in line; the last box holds a banana. You have the key to the first box, and you want the banana. + + +States: A state of the world is saying which boxes are locked and which are opened. All boxes except for the last contains a key that fits the following box. The last box contains a banana. You can have a single object on you and that is either a key or a banana (a key is gone when you unlock a box with it). For the problem with 6 boxes we have 7 states, 1 where all boxes are locked and 1 for when each box has been unlocked where you have the item that it contained. + +Initial state: You have the key for the first box. + +Actions: There should be one action called unlock. + +Transition Model: Unlock will unlock the left most locked box in the row with the key you have in your hand. You will also get the item in the unlocked box. + +Goal states: When you have the banana. + +Action cost: Each action cost 1. + + + + + +2. You start with the sequence ABABAECCEC, or in general any sequence made from A, B, C, and E. You can transform this sequence using the following equalities: AC = E, AB = BC, BB = E, and Ex = x for any x. For example, ABBC can be transformed into AEC, and then AC, and then E. Your goal is to produce the sequence E. + +States: A state can be any sequence of the letters A, B, C and E.The length of the sequence is greater or equal to 1. + +Initial state: Any state can be the initial state. + +Actions: We have 4 different actions: ACtoE, ABtoBC, BBtoE, EXtoX. The action is only applicable if a correct subsequence exist in the state. E.g. ACtoE is only applicable in state s if the sequence of state s contains the subsequence “AC”. Therefore, it’s not all the actions that are applicable in any state. + +Transition model: Performing an applicable action in a state s will provide a new state s’ where the sequence has been changed. E.g. performing the (applicable) action ABtoBC in state s will transform the sequence of state s so that every place that the subsequence “AB” will be changed to “BC”. The same pattern is true for the other actions, where X is seen as any letter. + +Goal State: The state with the sequence “E” + +Action cost: An action cost 1. + + +3. There is an n×n grid of squares, each square initially being either unpainted floor or a bottomless pit. You start standing on an unpainted floor square, and can either paint the square under you or move onto an adjacent unpainted floor square. You want the whole floor painted. + +States: A state description describes the location of each square and the property of the squares; painted floor, unpainted floor or a bottomless pit and also which square you are standing on. You cannot stand on the squares that are bottomless. + +Initial state: As long as n > 1 and there are at least 1 unpainted square that you are standing on any variation can be the initial state. + +Actions: There are the 4 movement actions; Up, Left, Right, Down these are only applicable if you end up on a square that is unpainted. Then there is the Paint action that is applicable if you are standing on a square that is unpainted. + +Transition Model: The movement action will moves you to a new square. E.g. Up will move you to the adjacent square above your current position. Paint will make the unpainted square you stand on to a painted square. + +Goal state: There are no unpainted squares. + +Action cost: Each action cost 1. + + + +4. A container ship is in port, loaded high with containers. There are 13 rows of containers, each 13 containers wide and 5 containers tall. You control a crane that can move to any location above the ship, pick up the container under it, and move it onto the dock. You want the ship unloaded. + + +States: A state description specifies the current amount of containers at all the locations. E.g There are 4 containers at row 1 column 1. + +Initial state: There are 13 rows of containers, each 13 containers wide and 5 containers tall. + +Actions: There is a PicknDock action that will pick up a container at a given location and move it to the dock, this action is only applicable if there is a container at the given location. + +Transition model: The resulting state from the PicknDock action will have one less container at the location. + +Goal state: There are no containers at any location on the ship. + +Action Cost: Combination of the cost of the resources it takes to have the crane running and time. + + + From cb68a2057670a9043313fc1846078ae0d50f1643 Mon Sep 17 00:00:00 2001 From: Jonas Sonn Jorgensen Date: Sat, 12 Dec 2020 21:09:37 +0100 Subject: [PATCH 3/7] Revert "Question typo correction and answers for exercises 3-5" This reverts commit a4d289978a097dfa6bcfd726c347458b853a0a33. --- .../exercises/ex_3/answers/answer.md | 77 ------------------- 1 file changed, 77 deletions(-) delete mode 100644 markdown/3-Solving-Problems-By-Searching/exercises/ex_3/answers/answer.md diff --git a/markdown/3-Solving-Problems-By-Searching/exercises/ex_3/answers/answer.md b/markdown/3-Solving-Problems-By-Searching/exercises/ex_3/answers/answer.md deleted file mode 100644 index 86031c61da..0000000000 --- a/markdown/3-Solving-Problems-By-Searching/exercises/ex_3/answers/answer.md +++ /dev/null @@ -1,77 +0,0 @@ -If we want to give a complete problem formulation of a problem we need to remember what a problem formulation consist of (from section 3.1): - -“PROBLEM FORMULATION: The agent devises a description of the states and actions -necessary to reach the goal—an abstract model of the relevant part of the world…” - -Section 3.1.1 describes more in depth what is required to define a search problem. We want a state space, an initial state, a set of goal states, a set of actions, a transition model and an action cost function. - -As stated in section 3.1.2 we should formulate a problem with the right level of abstraction, so that we only have the important details. - - -1. There are six glass boxes in a row, each with a lock. Each of the first five boxes holds a key unlocking the next box in line; the last box holds a banana. You have the key to the first box, and you want the banana. - - -States: A state of the world is saying which boxes are locked and which are opened. All boxes except for the last contains a key that fits the following box. The last box contains a banana. You can have a single object on you and that is either a key or a banana (a key is gone when you unlock a box with it). For the problem with 6 boxes we have 7 states, 1 where all boxes are locked and 1 for when each box has been unlocked where you have the item that it contained. - -Initial state: You have the key for the first box. - -Actions: There should be one action called unlock. - -Transition Model: Unlock will unlock the left most locked box in the row with the key you have in your hand. You will also get the item in the unlocked box. - -Goal states: When you have the banana. - -Action cost: Each action cost 1. - - - - - -2. You start with the sequence ABABAECCEC, or in general any sequence made from A, B, C, and E. You can transform this sequence using the following equalities: AC = E, AB = BC, BB = E, and Ex = x for any x. For example, ABBC can be transformed into AEC, and then AC, and then E. Your goal is to produce the sequence E. - -States: A state can be any sequence of the letters A, B, C and E.The length of the sequence is greater or equal to 1. - -Initial state: Any state can be the initial state. - -Actions: We have 4 different actions: ACtoE, ABtoBC, BBtoE, EXtoX. The action is only applicable if a correct subsequence exist in the state. E.g. ACtoE is only applicable in state s if the sequence of state s contains the subsequence “AC”. Therefore, it’s not all the actions that are applicable in any state. - -Transition model: Performing an applicable action in a state s will provide a new state s’ where the sequence has been changed. E.g. performing the (applicable) action ABtoBC in state s will transform the sequence of state s so that every place that the subsequence “AB” will be changed to “BC”. The same pattern is true for the other actions, where X is seen as any letter. - -Goal State: The state with the sequence “E” - -Action cost: An action cost 1. - - -3. There is an n×n grid of squares, each square initially being either unpainted floor or a bottomless pit. You start standing on an unpainted floor square, and can either paint the square under you or move onto an adjacent unpainted floor square. You want the whole floor painted. - -States: A state description describes the location of each square and the property of the squares; painted floor, unpainted floor or a bottomless pit and also which square you are standing on. You cannot stand on the squares that are bottomless. - -Initial state: As long as n > 1 and there are at least 1 unpainted square that you are standing on any variation can be the initial state. - -Actions: There are the 4 movement actions; Up, Left, Right, Down these are only applicable if you end up on a square that is unpainted. Then there is the Paint action that is applicable if you are standing on a square that is unpainted. - -Transition Model: The movement action will moves you to a new square. E.g. Up will move you to the adjacent square above your current position. Paint will make the unpainted square you stand on to a painted square. - -Goal state: There are no unpainted squares. - -Action cost: Each action cost 1. - - - -4. A container ship is in port, loaded high with containers. There are 13 rows of containers, each 13 containers wide and 5 containers tall. You control a crane that can move to any location above the ship, pick up the container under it, and move it onto the dock. You want the ship unloaded. - - -States: A state description specifies the current amount of containers at all the locations. E.g There are 4 containers at row 1 column 1. - -Initial state: There are 13 rows of containers, each 13 containers wide and 5 containers tall. - -Actions: There is a PicknDock action that will pick up a container at a given location and move it to the dock, this action is only applicable if there is a container at the given location. - -Transition model: The resulting state from the PicknDock action will have one less container at the location. - -Goal state: There are no containers at any location on the ship. - -Action Cost: Combination of the cost of the resources it takes to have the crane running and time. - - - From 2ead29549dec2b96056cc2b4af1dfbffba9ec998 Mon Sep 17 00:00:00 2001 From: Jonas Sonn Jorgensen Date: Sat, 12 Dec 2020 21:17:04 +0100 Subject: [PATCH 4/7] Fixed minor typo and added answers to exercise 3-2 --- .../exercises/ex_2/answers/answer.md | 77 +++++++++++++++++++ .../exercises/ex_2/question.md | 2 +- 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 markdown/3-Solving-Problems-By-Searching/exercises/ex_2/answers/answer.md diff --git a/markdown/3-Solving-Problems-By-Searching/exercises/ex_2/answers/answer.md b/markdown/3-Solving-Problems-By-Searching/exercises/ex_2/answers/answer.md new file mode 100644 index 0000000000..86031c61da --- /dev/null +++ b/markdown/3-Solving-Problems-By-Searching/exercises/ex_2/answers/answer.md @@ -0,0 +1,77 @@ +If we want to give a complete problem formulation of a problem we need to remember what a problem formulation consist of (from section 3.1): + +“PROBLEM FORMULATION: The agent devises a description of the states and actions +necessary to reach the goal—an abstract model of the relevant part of the world…” + +Section 3.1.1 describes more in depth what is required to define a search problem. We want a state space, an initial state, a set of goal states, a set of actions, a transition model and an action cost function. + +As stated in section 3.1.2 we should formulate a problem with the right level of abstraction, so that we only have the important details. + + +1. There are six glass boxes in a row, each with a lock. Each of the first five boxes holds a key unlocking the next box in line; the last box holds a banana. You have the key to the first box, and you want the banana. + + +States: A state of the world is saying which boxes are locked and which are opened. All boxes except for the last contains a key that fits the following box. The last box contains a banana. You can have a single object on you and that is either a key or a banana (a key is gone when you unlock a box with it). For the problem with 6 boxes we have 7 states, 1 where all boxes are locked and 1 for when each box has been unlocked where you have the item that it contained. + +Initial state: You have the key for the first box. + +Actions: There should be one action called unlock. + +Transition Model: Unlock will unlock the left most locked box in the row with the key you have in your hand. You will also get the item in the unlocked box. + +Goal states: When you have the banana. + +Action cost: Each action cost 1. + + + + + +2. You start with the sequence ABABAECCEC, or in general any sequence made from A, B, C, and E. You can transform this sequence using the following equalities: AC = E, AB = BC, BB = E, and Ex = x for any x. For example, ABBC can be transformed into AEC, and then AC, and then E. Your goal is to produce the sequence E. + +States: A state can be any sequence of the letters A, B, C and E.The length of the sequence is greater or equal to 1. + +Initial state: Any state can be the initial state. + +Actions: We have 4 different actions: ACtoE, ABtoBC, BBtoE, EXtoX. The action is only applicable if a correct subsequence exist in the state. E.g. ACtoE is only applicable in state s if the sequence of state s contains the subsequence “AC”. Therefore, it’s not all the actions that are applicable in any state. + +Transition model: Performing an applicable action in a state s will provide a new state s’ where the sequence has been changed. E.g. performing the (applicable) action ABtoBC in state s will transform the sequence of state s so that every place that the subsequence “AB” will be changed to “BC”. The same pattern is true for the other actions, where X is seen as any letter. + +Goal State: The state with the sequence “E” + +Action cost: An action cost 1. + + +3. There is an n×n grid of squares, each square initially being either unpainted floor or a bottomless pit. You start standing on an unpainted floor square, and can either paint the square under you or move onto an adjacent unpainted floor square. You want the whole floor painted. + +States: A state description describes the location of each square and the property of the squares; painted floor, unpainted floor or a bottomless pit and also which square you are standing on. You cannot stand on the squares that are bottomless. + +Initial state: As long as n > 1 and there are at least 1 unpainted square that you are standing on any variation can be the initial state. + +Actions: There are the 4 movement actions; Up, Left, Right, Down these are only applicable if you end up on a square that is unpainted. Then there is the Paint action that is applicable if you are standing on a square that is unpainted. + +Transition Model: The movement action will moves you to a new square. E.g. Up will move you to the adjacent square above your current position. Paint will make the unpainted square you stand on to a painted square. + +Goal state: There are no unpainted squares. + +Action cost: Each action cost 1. + + + +4. A container ship is in port, loaded high with containers. There are 13 rows of containers, each 13 containers wide and 5 containers tall. You control a crane that can move to any location above the ship, pick up the container under it, and move it onto the dock. You want the ship unloaded. + + +States: A state description specifies the current amount of containers at all the locations. E.g There are 4 containers at row 1 column 1. + +Initial state: There are 13 rows of containers, each 13 containers wide and 5 containers tall. + +Actions: There is a PicknDock action that will pick up a container at a given location and move it to the dock, this action is only applicable if there is a container at the given location. + +Transition model: The resulting state from the PicknDock action will have one less container at the location. + +Goal state: There are no containers at any location on the ship. + +Action Cost: Combination of the cost of the resources it takes to have the crane running and time. + + + diff --git a/markdown/3-Solving-Problems-By-Searching/exercises/ex_2/question.md b/markdown/3-Solving-Problems-By-Searching/exercises/ex_2/question.md index 4bec20f617..5e6fef5823 100644 --- a/markdown/3-Solving-Problems-By-Searching/exercises/ex_2/question.md +++ b/markdown/3-Solving-Problems-By-Searching/exercises/ex_2/question.md @@ -20,7 +20,7 @@ Choose a formulation that is precise enough to be implemented.
you or move onto an adjacent unpainted floor square. You want the whole floor painted.
-4. A container ship is in port, loaded high with containers. There 13 +4. A container ship is in port, loaded high with containers. There are 13 rows of containers, each 13 containers wide and 5 containers tall. You control a crane that can move to any location above the ship, pick up the container under it, and move it onto the dock. You want From c8e04f38303994c0ea6748c8d32f429b50993d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sonn=20J=C3=B8rgensen?= Date: Sat, 12 Dec 2020 21:20:21 +0100 Subject: [PATCH 5/7] Update when question have been answered --- markdown/3-Solving-Problems-By-Searching/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markdown/3-Solving-Problems-By-Searching/README.md b/markdown/3-Solving-Problems-By-Searching/README.md index 314fbcc024..ccc53fd4a0 100644 --- a/markdown/3-Solving-Problems-By-Searching/README.md +++ b/markdown/3-Solving-Problems-By-Searching/README.md @@ -3,7 +3,7 @@ | **Exercise #** | **Status** | **Markdown** | |:------------|:-----------|:-----------------| | 1 | Unanswered | [`Question`](exercises/ex_1/question.md)| -| 2 | Unanswered | [`Question`](exercises/ex_2/question.md)| +| 2 | [`Answer`](exercises/ex_2/answers/answer.md) | [`Question`](exercises/ex_2/question.md)| | 3 | Unanswered | [`Question`](exercises/ex_3/question.md)| | 4 | Unanswered | [`Question`](exercises/ex_4/question.md)| | 5 | Unanswered | [`Question`](exercises/ex_5/question.md)| From d777b2ebcc0121db6b34ad2d600a09e5e115c210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sonn=20J=C3=B8rgensen?= Date: Sat, 12 Dec 2020 21:28:54 +0100 Subject: [PATCH 6/7] Update answer 3-2 so that it --- .../exercises/ex_2/answers/answer.md | 68 ++++++++----------- 1 file changed, 30 insertions(+), 38 deletions(-) diff --git a/markdown/3-Solving-Problems-By-Searching/exercises/ex_2/answers/answer.md b/markdown/3-Solving-Problems-By-Searching/exercises/ex_2/answers/answer.md index 86031c61da..121d8bbf0c 100644 --- a/markdown/3-Solving-Problems-By-Searching/exercises/ex_2/answers/answer.md +++ b/markdown/3-Solving-Problems-By-Searching/exercises/ex_2/answers/answer.md @@ -1,77 +1,69 @@ If we want to give a complete problem formulation of a problem we need to remember what a problem formulation consist of (from section 3.1): -“PROBLEM FORMULATION: The agent devises a description of the states and actions -necessary to reach the goal—an abstract model of the relevant part of the world…” +##### PROBLEM FORMULATION: The agent devises a description of the states and actions necessary to reach the goal—an abstract model of the relevant part of the world…” -Section 3.1.1 describes more in depth what is required to define a search problem. We want a state space, an initial state, a set of goal states, a set of actions, a transition model and an action cost function. +Section 3.1.1 describes more in depth what is required to define a search problem. We want a state space, an initial state, a set of goal states, a set of actions, a transition model and an action cost function. And as stated in section 3.1.2 we should formulate a problem with the right level of abstraction, so that we only have the important details. -As stated in section 3.1.2 we should formulate a problem with the right level of abstraction, so that we only have the important details. +#### 1. *There are six glass boxes in a row, each with a lock. Each of the first five boxes holds a key unlocking the next box in line; the last box holds a banana. You have the key to the first box, and you want the banana.* -1. There are six glass boxes in a row, each with a lock. Each of the first five boxes holds a key unlocking the next box in line; the last box holds a banana. You have the key to the first box, and you want the banana. +> **States**: A state of the world is saying which boxes are locked and which are opened. All boxes except for the last contains a key that fits the following box. The last box contains a banana. You can have a single object on you and that is either a key or a banana (a key is gone when you unlock a box with it). For the problem with 6 boxes we have 7 states, 1 where all boxes are locked and 1 for when each box has been unlocked where you have the item that it contained. +> Initial state: You have the key for the first box. -States: A state of the world is saying which boxes are locked and which are opened. All boxes except for the last contains a key that fits the following box. The last box contains a banana. You can have a single object on you and that is either a key or a banana (a key is gone when you unlock a box with it). For the problem with 6 boxes we have 7 states, 1 where all boxes are locked and 1 for when each box has been unlocked where you have the item that it contained. +**Actions**: There should be one action called unlock. -Initial state: You have the key for the first box. +**Transition Model**: Unlock will unlock the left most locked box in the row with the key you have in your hand. You will also get the item in the unlocked box. -Actions: There should be one action called unlock. +**Goal states**: When you have the banana. -Transition Model: Unlock will unlock the left most locked box in the row with the key you have in your hand. You will also get the item in the unlocked box. +**Action cost**: Each action cost 1.
-Goal states: When you have the banana. -Action cost: Each action cost 1. +#### 2. *You start with the sequence ABABAECCEC, or in general any sequence made from A, B, C, and E. You can transform this sequence using the following equalities: AC = E, AB = BC, BB = E, and Ex = x for any x. For example, ABBC can be transformed into AEC, and then AC, and then E. Your goal is to produce the sequence E.* - +**States**: A state can be any sequence of the letters A, B, C and E.The length of the sequence is greater or equal to 1. +**Initial state**: Any state can be the initial state. +**Actions**: We have 4 different actions: ACtoE, ABtoBC, BBtoE, EXtoX. The action is only applicable if a correct subsequence exist in the state. E.g. ACtoE is only applicable in state s if the sequence of state s contains the subsequence “AC”. Therefore, it’s not all the actions that are applicable in any state. -2. You start with the sequence ABABAECCEC, or in general any sequence made from A, B, C, and E. You can transform this sequence using the following equalities: AC = E, AB = BC, BB = E, and Ex = x for any x. For example, ABBC can be transformed into AEC, and then AC, and then E. Your goal is to produce the sequence E. +**Transition model**: Performing an applicable action in a state s will provide a new state s’ where the sequence has been changed. E.g. performing the (applicable) action ABtoBC in state s will transform the sequence of state s so that every place that the subsequence “AB” will be changed to “BC”. The same pattern is true for the other actions, where X is seen as any letter. -States: A state can be any sequence of the letters A, B, C and E.The length of the sequence is greater or equal to 1. +**Goal State**: The state with the sequence “E” -Initial state: Any state can be the initial state. +**Action cost**: An action cost 1. -Actions: We have 4 different actions: ACtoE, ABtoBC, BBtoE, EXtoX. The action is only applicable if a correct subsequence exist in the state. E.g. ACtoE is only applicable in state s if the sequence of state s contains the subsequence “AC”. Therefore, it’s not all the actions that are applicable in any state. -Transition model: Performing an applicable action in a state s will provide a new state s’ where the sequence has been changed. E.g. performing the (applicable) action ABtoBC in state s will transform the sequence of state s so that every place that the subsequence “AB” will be changed to “BC”. The same pattern is true for the other actions, where X is seen as any letter. +#### 3. *There is an n×n grid of squares, each square initially being either unpainted floor or a bottomless pit. You start standing on an unpainted floor square, and can either paint the square under you or move onto an adjacent unpainted floor square. You want the whole floor painted*. -Goal State: The state with the sequence “E” +**States**: A state description describes the location of each square and the property of the squares; painted floor, unpainted floor or a bottomless pit and also which square you are standing on. You cannot stand on the squares that are bottomless. -Action cost: An action cost 1. +**Initial state**: As long as n > 1 and there are at least 1 unpainted square that you are standing on any variation can be the initial state. +**Actions**: There are the 4 movement actions; Up, Left, Right, Down these are only applicable if you end up on a square that is unpainted. Then there is the Paint action that is applicable if you are standing on a square that is unpainted. -3. There is an n×n grid of squares, each square initially being either unpainted floor or a bottomless pit. You start standing on an unpainted floor square, and can either paint the square under you or move onto an adjacent unpainted floor square. You want the whole floor painted. +**Transition Model**: The movement action will moves you to a new square. E.g. Up will move you to the adjacent square above your current position. Paint will make the unpainted square you stand on to a painted square. -States: A state description describes the location of each square and the property of the squares; painted floor, unpainted floor or a bottomless pit and also which square you are standing on. You cannot stand on the squares that are bottomless. +**Goal state**: There are no unpainted squares. -Initial state: As long as n > 1 and there are at least 1 unpainted square that you are standing on any variation can be the initial state. +**Action cost**: Each action cost 1. -Actions: There are the 4 movement actions; Up, Left, Right, Down these are only applicable if you end up on a square that is unpainted. Then there is the Paint action that is applicable if you are standing on a square that is unpainted. -Transition Model: The movement action will moves you to a new square. E.g. Up will move you to the adjacent square above your current position. Paint will make the unpainted square you stand on to a painted square. +#### 4. *A container ship is in port, loaded high with containers. There are 13 rows of containers, each 13 containers wide and 5 containers tall. You control a crane that can move to any location above the ship, pick up the container under it, and move it onto the dock. You want the ship unloaded.* -Goal state: There are no unpainted squares. -Action cost: Each action cost 1. +**States**: A state description specifies the current amount of containers at all the locations. E.g There are 4 containers at row 1 column 1. +**Initial state**: There are 13 rows of containers, each 13 containers wide and 5 containers tall. +**Actions**: There is a PicknDock action that will pick up a container at a given location and move it to the dock, this action is only applicable if there is a container at the given location. -4. A container ship is in port, loaded high with containers. There are 13 rows of containers, each 13 containers wide and 5 containers tall. You control a crane that can move to any location above the ship, pick up the container under it, and move it onto the dock. You want the ship unloaded. +**Transition model**: The resulting state from the PicknDock action will have one less container at the location. +**Goal state**: There are no containers at any location on the ship. -States: A state description specifies the current amount of containers at all the locations. E.g There are 4 containers at row 1 column 1. - -Initial state: There are 13 rows of containers, each 13 containers wide and 5 containers tall. - -Actions: There is a PicknDock action that will pick up a container at a given location and move it to the dock, this action is only applicable if there is a container at the given location. - -Transition model: The resulting state from the PicknDock action will have one less container at the location. - -Goal state: There are no containers at any location on the ship. - -Action Cost: Combination of the cost of the resources it takes to have the crane running and time. +**Action Cost**: Combination of the cost of the resources it takes to have the crane running and time. From 42e52a7af68ead9f0b6efadacf223780fa8d0845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sonn=20J=C3=B8rgensen?= Date: Sat, 12 Dec 2020 21:30:26 +0100 Subject: [PATCH 7/7] Update answer 3-2 so that it is more readable --- .../exercises/ex_2/answers/answer.md | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/markdown/3-Solving-Problems-By-Searching/exercises/ex_2/answers/answer.md b/markdown/3-Solving-Problems-By-Searching/exercises/ex_2/answers/answer.md index 121d8bbf0c..a1be5a2fec 100644 --- a/markdown/3-Solving-Problems-By-Searching/exercises/ex_2/answers/answer.md +++ b/markdown/3-Solving-Problems-By-Searching/exercises/ex_2/answers/answer.md @@ -9,61 +9,61 @@ Section 3.1.1 describes more in depth what is required to define a search proble > **States**: A state of the world is saying which boxes are locked and which are opened. All boxes except for the last contains a key that fits the following box. The last box contains a banana. You can have a single object on you and that is either a key or a banana (a key is gone when you unlock a box with it). For the problem with 6 boxes we have 7 states, 1 where all boxes are locked and 1 for when each box has been unlocked where you have the item that it contained. -> Initial state: You have the key for the first box. +> **Initial state**: You have the key for the first box. -**Actions**: There should be one action called unlock. +> **Actions**: There should be one action called unlock. -**Transition Model**: Unlock will unlock the left most locked box in the row with the key you have in your hand. You will also get the item in the unlocked box. +> **Transition Model**: Unlock will unlock the left most locked box in the row with the key you have in your hand. You will also get the item in the unlocked box. -**Goal states**: When you have the banana. +> **Goal states**: When you have the banana. -**Action cost**: Each action cost 1.
+> **Action cost**: Each action cost 1.
#### 2. *You start with the sequence ABABAECCEC, or in general any sequence made from A, B, C, and E. You can transform this sequence using the following equalities: AC = E, AB = BC, BB = E, and Ex = x for any x. For example, ABBC can be transformed into AEC, and then AC, and then E. Your goal is to produce the sequence E.* -**States**: A state can be any sequence of the letters A, B, C and E.The length of the sequence is greater or equal to 1. +> **States**: A state can be any sequence of the letters A, B, C and E.The length of the sequence is greater or equal to 1. -**Initial state**: Any state can be the initial state. +> **Initial state**: Any state can be the initial state. -**Actions**: We have 4 different actions: ACtoE, ABtoBC, BBtoE, EXtoX. The action is only applicable if a correct subsequence exist in the state. E.g. ACtoE is only applicable in state s if the sequence of state s contains the subsequence “AC”. Therefore, it’s not all the actions that are applicable in any state. +> **Actions**: We have 4 different actions: ACtoE, ABtoBC, BBtoE, EXtoX. The action is only applicable if a correct subsequence exist in the state. E.g. ACtoE is only applicable in state s if the sequence of state s contains the subsequence “AC”. Therefore, it’s not all the actions that are applicable in any state. -**Transition model**: Performing an applicable action in a state s will provide a new state s’ where the sequence has been changed. E.g. performing the (applicable) action ABtoBC in state s will transform the sequence of state s so that every place that the subsequence “AB” will be changed to “BC”. The same pattern is true for the other actions, where X is seen as any letter. +> **Transition model**: Performing an applicable action in a state s will provide a new state s’ where the sequence has been changed. E.g. performing the (applicable) action ABtoBC in state s will transform the sequence of state s so that every place that the subsequence “AB” will be changed to “BC”. The same pattern is true for the other actions, where X is seen as any letter. -**Goal State**: The state with the sequence “E” +> **Goal State**: The state with the sequence “E” -**Action cost**: An action cost 1. +> **Action cost**: An action cost 1. #### 3. *There is an n×n grid of squares, each square initially being either unpainted floor or a bottomless pit. You start standing on an unpainted floor square, and can either paint the square under you or move onto an adjacent unpainted floor square. You want the whole floor painted*. -**States**: A state description describes the location of each square and the property of the squares; painted floor, unpainted floor or a bottomless pit and also which square you are standing on. You cannot stand on the squares that are bottomless. +> **States**: A state description describes the location of each square and the property of the squares; painted floor, unpainted floor or a bottomless pit and also which square you are standing on. You cannot stand on the squares that are bottomless. -**Initial state**: As long as n > 1 and there are at least 1 unpainted square that you are standing on any variation can be the initial state. +> **Initial state**: As long as n > 1 and there are at least 1 unpainted square that you are standing on any variation can be the initial state. -**Actions**: There are the 4 movement actions; Up, Left, Right, Down these are only applicable if you end up on a square that is unpainted. Then there is the Paint action that is applicable if you are standing on a square that is unpainted. +> **Actions**: There are the 4 movement actions; Up, Left, Right, Down these are only applicable if you end up on a square that is unpainted. Then there is the Paint action that is applicable if you are standing on a square that is unpainted. -**Transition Model**: The movement action will moves you to a new square. E.g. Up will move you to the adjacent square above your current position. Paint will make the unpainted square you stand on to a painted square. +> **Transition Model**: The movement action will moves you to a new square. E.g. Up will move you to the adjacent square above your current position. Paint will make the unpainted square you stand on to a painted square. -**Goal state**: There are no unpainted squares. +> **Goal state**: There are no unpainted squares. -**Action cost**: Each action cost 1. +> **Action cost**: Each action cost 1. #### 4. *A container ship is in port, loaded high with containers. There are 13 rows of containers, each 13 containers wide and 5 containers tall. You control a crane that can move to any location above the ship, pick up the container under it, and move it onto the dock. You want the ship unloaded.* -**States**: A state description specifies the current amount of containers at all the locations. E.g There are 4 containers at row 1 column 1. +> **States**: A state description specifies the current amount of containers at all the locations. E.g There are 4 containers at row 1 column 1. -**Initial state**: There are 13 rows of containers, each 13 containers wide and 5 containers tall. +> **Initial state**: There are 13 rows of containers, each 13 containers wide and 5 containers tall. -**Actions**: There is a PicknDock action that will pick up a container at a given location and move it to the dock, this action is only applicable if there is a container at the given location. +> **Actions**: There is a PicknDock action that will pick up a container at a given location and move it to the dock, this action is only applicable if there is a container at the given location. -**Transition model**: The resulting state from the PicknDock action will have one less container at the location. +> **Transition model**: The resulting state from the PicknDock action will have one less container at the location. -**Goal state**: There are no containers at any location on the ship. +> **Goal state**: There are no containers at any location on the ship. -**Action Cost**: Combination of the cost of the resources it takes to have the crane running and time. +> **Action Cost**: Combination of the cost of the resources it takes to have the crane running and time.