19th Ave New York, NY 95822, USA

# 计算机代写|机器学习代写Machine Learning代考|COMP4702 Local search

my-assignmentexpert™提供最专业的一站式服务：Essay代写，Dissertation代写，Assignment代写，Paper代写，Proposal代写，Proposal代写，Literature Review代写，Online Course，Exam代考等等。my-assignmentexpert™专注为留学生提供Essay代写服务，拥有各个专业的博硕教师团队帮您代写，免费修改及辅导，保证成果完成的效率和质量。同时有多家检测平台帐号，包括Turnitin高级账户，检测论文不会留痕，写好后检测修改，放心可靠，经得起任何考验！

## 计算机代写|机器学习代写Machine Learning代考|Local search

In this section, we discuss heuristic optimization algorithms that try to find the global maximum in a discrete, unstructured search space. These algorithms replace the local gradient based update, which has the form $\boldsymbol{\theta}{t+1}=\boldsymbol{\theta}_t+\eta_t \boldsymbol{d}_t$, with the following discrete analog: $$\boldsymbol{x}{t+1}=\underset{\boldsymbol{x} \in \operatorname{nbr}\left(\boldsymbol{x}_t\right)}{\operatorname{argmax}} \mathcal{L}(\boldsymbol{x})$$
where $\operatorname{nbr}\left(\boldsymbol{x}_t\right) \subseteq \mathcal{X}$ is the set of neighbors of $\boldsymbol{x}_t$. This is called hill climbing, steepest ascent, or greedy search.

If the “neighborhood” of a point contains the entire space, Equation (6.71) will return the global optimum in one step, but usually such a global neighborhood is too large to search exhaustively. Consequently we usually define local neighborhoods. For example, consider the 8-queens problem. Here the goal is to place queens on an $8 \times 8$ chessboard so that they don’t attack each other (see Figure 6.6). The state space has the form $\mathcal{X}=64^8$, since we have to specify the location of each queen on the grid. However, due to the constraints, there are only $8^8 \approx 17 M$ feasible states. We define the neighbors of a state to be all possible states generated by moving a single queen to another square in the same column, so each node has $8 \times 7=56$ neighbors. According to [RN10, p.123], if we start at a randomly generated 8-queens state, steepest ascent gets stuck at a local maximum $86 \%$ of the time, so it only solves $14 \%$ of problem instances. However, it is fast, taking an average of 4 steps when it succeeds and 3 when it gets stuck.

In the sections below, we discuss slightly smarter algorithms that are less likely to get stuck in local maxima.

## 计算机代写|机器学习代写Machine Learning代考|Stochastic local search

Hill climbing is greedy, since it picks the best point in its local neighborhood, by solving Equation (6.71) exactly. One way to reduce the chance of getting stuck in local maxima is to approximately maximize this objective at each step. For example, we can define a probability distribution over the uphill neighbors, proportional to how much they improve, and then sample one at random. This is called stochastic hill climbing. If we gradually decrease the entropy of this probability distribution (so we become greedier over time), we get a method called simulated annealing, which we discuss in ??.

Another simple technique is to use greedy hill climbing, but then whenever we reach a local maximum, we start again from a different random starting point. This is called random restart hill climbing. To see the benefit of this, consider again the 8-queens problem. If each hill-climbing search has a probability of $p \approx 0.14$ of success, then we expect to need $R=1 / p \approx 7$ restarts until we find a valid solution. The expected number of total steps can be computed as follows. Let $N_1=4$ be the average number of steps for successful trials, and $N_0=3$ be the average number of steps for failures. Then the total number of steps on average is $N_1+(R-1) N_0=4+6 \times 3=22$. Since each step is quick, the overall method is very fast. For example, it can solve an $n$-queens problem with $n=1 \mathrm{M}$ in under a minute.

Of course, solving the $n$-queens problem is not the most useful task in practice. However, it is typical of several real-world boolean satisfiability problems, which arise in problems ranging from AI planning to model checking (see e.g., [SLM92]). In such problems, simple stochastic local search (SLS) algorithms of the kind we have discussed work surprisingly well (see e.g., [HS05]).

## 计算机代写|机器学习代写MACHINE LEARNING代考|LOCAL SEARCH

$$\boldsymbol{x} t+1=\underset{\boldsymbol{x} \in \operatorname{nbr}\left(\boldsymbol{x}_t\right)}{\operatorname{argmax}} \mathcal{L}(\boldsymbol{x})$$

RN10,p.123

## Matlab代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。