Skip to content

Commit

Permalink
初始化 Hugo 博客项目,添加基本配置和内容结构
Browse files Browse the repository at this point in the history
  • Loading branch information
whateverzpy committed Dec 10, 2024
1 parent 29e7caa commit 0b87124
Show file tree
Hide file tree
Showing 15 changed files with 196 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/public/
/resources/_gen/
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "themes/hugo-theme-stack"]
path = themes/hugo-theme-stack
url = https://github.com/CaiJimmy/hugo-theme-stack/
url = https://github.com/whateverzpy/hugo-theme-stack
Empty file added .hugo_build.lock
Empty file.
7 changes: 7 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Zlog

## 待办

- [ ] i18n 支持
- [ ] 搜索支持
- [ ] 评论支持
5 changes: 5 additions & 0 deletions archetypes/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
+++
date = '{{ .Date }}'
draft = true
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
+++
Binary file added assets/avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions assets/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"*": [
"..\\themes\\hugo-theme-stack\\assets\\*"
]
}
}
}
11 changes: 11 additions & 0 deletions content/about/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+++
categories = []
date = '2024-12-10'
description = ''
tags = []
title = '关于我'
+++

## 关于我

- 只是一个平平无奇的计算机系学生。。。。
3 changes: 3 additions & 0 deletions content/post/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
+++
title = '文章'
+++
7 changes: 7 additions & 0 deletions content/post/first-post/hugo-logo-wide.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions content/post/first-post/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
+++
categories = []
date = '2024-12-10'
description = '用 Hugo 搭建个人博客'
tags = ['Hugo', '博客']
title = '浅尝 Hugo'
image = 'hugo-logo-wide.svg'
weight = -1
+++

## 关于

本博客由 [Hugo](https://gohugo.io/) 搭建。
86 changes: 86 additions & 0 deletions content/post/my-second-post/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
+++
categories = []
date = '2024-12-10'
description = '最优化方法作业的解答'
tags = ['最优化方法']
title = '最优化方法作业'
weight = -2
+++

## 题目 1

$$
\begin{cases}
\min &f(\mathbf{x})=(x_1-\frac{9}{4})^2+(x_2-2)^2 \\
s.t.&x_2-x_1^2\ge0, \\
&x_1+x_2\le6, \\
&x_1,x_2\ge0
\end{cases}
$$

验证 $\mathbf{x}^*=(1.5,2.25)^T$ 是 K-T 点。

### 解答

$$
\begin{cases}
g_1(\mathbf{x})=x_1^2-x_2 \\
g_2(\mathbf{x})=x_1+x_2-6 \\
g_3(\mathbf{x})=-x_1 \\
g_4(\mathbf{x})=-x_2
\end{cases}
$$

显然仅有 $g_1(\mathbf{x}^*)=0$,$I=\{1\}$,计算梯度

$$
\begin{aligned}
&\nabla f(\mathbf{x})=\begin{pmatrix}2x_1-\frac{9}{2} \\ 2x_2-4\end{pmatrix}^T \\
&\nabla g_1(\mathbf{x})=\begin{pmatrix}2x_1 \\ -1\end{pmatrix}^T
\end{aligned}
$$

将 $\mathbf{x}^*$ 代入得

$$
\begin{cases}
-\frac{3}{2}+3u_1=0 \\
\frac{1}{2}-u_1=0
\end{cases}
$$

解得 $u_1=\frac{1}{2}\ge0$,故 $\mathbf{x}^*=(1.5,2.25)^T$ 是 K-T 点。

## 题目 2

通过 K-T 条件求解下列问题

$$
\begin{cases}
\min &f(\mathbf{x})=-3x_1+x_2-x_3^2 \\
s.t.&x_1+x_2+x_3\le0, \\
&-x_1+2x_2+x_3^2=0
\end{cases}
$$

### 解答

计算梯度

$$
\nabla f(\mathbf{x})=\begin{pmatrix}-3 \\ 1 \\ -2x_3\end{pmatrix}^T
$$

海塞矩阵

$$
\nabla^2f(\mathbf{x})=\begin{pmatrix}0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & -2\end{pmatrix}
$$

不是正定矩阵或半正定矩阵,因此该问题不是凸优化,可以观察到,若令

$$
x_1=0,x_2=- \frac{1}{2}x_3^2
$$

显然有 $f(\mathbf{x})$ 无界,不存在最优解。
51 changes: 51 additions & 0 deletions hugo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
baseURL = 'https://example.org/'
languageCode = 'zh-CN'
title = 'WhateverZ'
theme = "hugo-theme-stack"
has-CJKLanguage = true
defaultContentLanguage = "zh-cn"

[Params]
favicon = "/favicon.png"
math = true

[Params.Sidebar]
avatar = { src = "/avatar.png" }

[Params.Footer]
since = 2024

[menus]
[[menus.main]]
name = '主页'
title = '主页'
pageRef = '/'
weight = 10
[[menus.main]]
name = '文章'
title = '文章'
pageRef = '/post'
weight = 20
[[menus.main]]
name = '关于'
title = '关于'
pageRef = '/about'
weight = 30

[Params.Article]
math = true

[markup]
[markup.goldmark]
[markup.goldmark.renderer]
unsafe = true
[markup.goldmark.extensions.passthrough]
enable = true
delimiters.block = [
["\\[", "\\]"],
["$$", "$$"]
]
delimiters.inline = [
["\\(", "\\)"],
["$", "$"]
]
Empty file.
Binary file added static/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0b87124

Please sign in to comment.