CS代写 Problem 1 (30p)

Problem 1 (30p)
We examine a product of non-negative numbers given their sum. Concretely, the problem is to find all among all non-negative reals such that their product is maximized, given their sum .
1.1. (15p) Cast the problem as a nonlinear two-dimensional optimization problem over with box constraints (hint: remove the sum constraint, and ignore one of the positivity constraints which should not be violated with proper initialization) and solve it using the L-BFGS-B method of scipy.optimize.minimize .
1.2. (15p) Cast the problem as an equivalent one-dimensional constrained optimization problem (hint: after removing the sum constraint, can you further use optimality conditions to remove one more variable?), and solve it using scipy.optimize.minimize_scalar .

Copyright By PowCoder代写 加微信 powcoder

Problem 2 (70p)
Let us consider the following function,
find all extremal points (both minima and maxima) in the region .
The goal is to: (a) find extremal points; (b) compare convergence, i.e. the numbers of: Iterations, Function
evaluations, Gradient evaluations, Hessian evaluations.
Solve the problem by using the Newton optimization routine “scipy.optimize.fmin_ncg”:
2.1. (20p) providing gradient (fprime) and Hessian (fhess) in “scipy.optimize.fmin_ncg”
2.2. (20p) providing only gradient (fprime) in “scipy.optimize.fmin_ncg”
Solve the problem by using the quasi-Newton optimization routine “fmin_bfgs”:
2.3. (20p) not providing gradient (fprime) or Hessian (like in “scipy.optimize.fmin_ncg”).
Use JAX for computing the gradient and Hessian as in the lecture. (make sure the gradient and Hessian are correctly computed).
2.4. (10p) Plot in the given region .
Hint: Note there are multiple extremal points in the given region. So one has to run the Newton routine with different starting points in order to find different extremal points.
For every extremal point report:
(xopt, yopt)
h(xopt, yopt)
(xstart, ystart)
the number of Iterations
the number of Function evaluations the number of Gradient evaluations the number of Hessian evaluations.
01 ≤ 𝑦,𝑥 ≤ 01−
01 ≤ 𝑦 ,𝑥 ≤ 01−
.2)71− 2𝑦+𝑥(+ 2)01−𝑦+ 2𝑥( =: )𝑦,𝑥(h
𝑧𝑦𝑥 = )𝑧,𝑦,𝑥(𝑃 0 ≥ 𝑧,𝑦,𝑥
072 = 𝑧+𝑦+𝑥

Hint 2: There are both local mimima and maxima; notice that “scipy.optimize.fmin_ncg” finds “minimum” not the “maximum”. To locate stationary points, partition into multiple regions and use “optimize.brute” in each of these regions. Then use the resulting points as starting points in “scipy.optimize.fmin_ncg”.
01 ≤ 𝑦 ,𝑥 ≤ 01−

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com