From 0ee8a492dcafb486877352b9b248a3f42d014294 Mon Sep 17 00:00:00 2001 From: Yusheng Zhao Date: Mon, 12 May 2025 10:35:33 +0800 Subject: [PATCH 1/4] up --- hw1/YushengZhao/p9_16.jl | 2 ++ hw1/YushengZhao/p9_6.jl | 2 ++ hw1/YushengZhao/p9_7.jl | 7 +++++++ 3 files changed, 11 insertions(+) create mode 100644 hw1/YushengZhao/p9_16.jl create mode 100644 hw1/YushengZhao/p9_6.jl create mode 100644 hw1/YushengZhao/p9_7.jl diff --git a/hw1/YushengZhao/p9_16.jl b/hw1/YushengZhao/p9_16.jl new file mode 100644 index 0000000..3ae65e0 --- /dev/null +++ b/hw1/YushengZhao/p9_16.jl @@ -0,0 +1,2 @@ +# min(b') s.t A' x' + b' = b x'>= 0 and b' >= 0 +# trivial solution is x' = 0 and b' = b \ No newline at end of file diff --git a/hw1/YushengZhao/p9_6.jl b/hw1/YushengZhao/p9_6.jl new file mode 100644 index 0000000..e27c33f --- /dev/null +++ b/hw1/YushengZhao/p9_6.jl @@ -0,0 +1,2 @@ +# standard DP problem +# needs $log(v_max)$ bits to describe $v_max$. Exponential time \ No newline at end of file diff --git a/hw1/YushengZhao/p9_7.jl b/hw1/YushengZhao/p9_7.jl new file mode 100644 index 0000000..c5586b4 --- /dev/null +++ b/hw1/YushengZhao/p9_7.jl @@ -0,0 +1,7 @@ +# floor division of K rounds some weights to 0, such weights maybe added in correctly to solution +# very roughly +# ϵ ∝ Σ_i floor(v_i / K) +# ϵ ∝ floor(v_i / K) * l +# K ∝ l/ϵ +# but also need to supress v_max to be small, let +# K = v_max * l / ϵ From 96fa78ab1b34ef00c248ac1c8d57243069c2d226 Mon Sep 17 00:00:00 2001 From: Yusheng Zhao Date: Mon, 19 May 2025 20:35:39 +0800 Subject: [PATCH 2/4] do --- hw2/YushengZhao/9_26.jl | 4 ++++ hw2/YushengZhao/9_27.jl | 1 + 2 files changed, 5 insertions(+) create mode 100644 hw2/YushengZhao/9_26.jl create mode 100644 hw2/YushengZhao/9_27.jl diff --git a/hw2/YushengZhao/9_26.jl b/hw2/YushengZhao/9_26.jl new file mode 100644 index 0000000..8272380 --- /dev/null +++ b/hw2/YushengZhao/9_26.jl @@ -0,0 +1,4 @@ +# according to hint, when formula is satisfied, we have 1/2 - y_0/3 <= y_i <= 1/2 +y_0 +# and to minimize f(x) need to maximize (y_i-1/2)^2, which is y_i at its upper bound and gives (y_i - 1/2)^2 = y_0^2, that gives lower bound of f(x) = -1/2y_0^2 +# on the other hand if the formula is not satisfied, the bound of y_i is 1/2 - y_0/3 <= y_i <= 1/2 +y_0, and the maximum of f(x) is sum y_0^2 - y_0^2/9 - 1/2n * n * -y_0^2/9 = 7/18 y_0^2 +# Q: is p(x) missing 1/n? diff --git a/hw2/YushengZhao/9_27.jl b/hw2/YushengZhao/9_27.jl new file mode 100644 index 0000000..6cc5af7 --- /dev/null +++ b/hw2/YushengZhao/9_27.jl @@ -0,0 +1 @@ +# x0 + sum ki vi where Avi = 0 and Ax0 = b , use https://en.wikipedia.org/wiki/Smith_normal_form to solve \ No newline at end of file From 59783b4767edf8e5e4d0ad8259fac9325de321d8 Mon Sep 17 00:00:00 2001 From: Yusheng Zhao Date: Mon, 19 May 2025 20:57:28 +0800 Subject: [PATCH 3/4] up --- hw2/YushengZhao/9_26.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw2/YushengZhao/9_26.jl b/hw2/YushengZhao/9_26.jl index 8272380..595ce00 100644 --- a/hw2/YushengZhao/9_26.jl +++ b/hw2/YushengZhao/9_26.jl @@ -1,4 +1,5 @@ # according to hint, when formula is satisfied, we have 1/2 - y_0/3 <= y_i <= 1/2 +y_0 # and to minimize f(x) need to maximize (y_i-1/2)^2, which is y_i at its upper bound and gives (y_i - 1/2)^2 = y_0^2, that gives lower bound of f(x) = -1/2y_0^2 -# on the other hand if the formula is not satisfied, the bound of y_i is 1/2 - y_0/3 <= y_i <= 1/2 +y_0, and the maximum of f(x) is sum y_0^2 - y_0^2/9 - 1/2n * n * -y_0^2/9 = 7/18 y_0^2 -# Q: is p(x) missing 1/n? +# on the other hand if the formula is not satisfied, the bound of at least one y_i is 1/2 - y_0/3 <= y_i <= 1/2 +y_0, and the min f(x) is num unsat * y_0^2 - y_0^2/9 + sum_(sat clause) (y_0^2 - y_0^2) - y_0^2/2 + num_unsat * y_0^ / 2*n*9 which is at least 7/18 y_0^2 + +# using hint, if formula is satisfied, y^* cannot be local minimum because can slide over y_0 axis a little bit, epsilon, and get lower. this is in the neighborhood of y^* because y_i' 's difference from y_i = 1/2 is bounded by the epsilon. And f(x)'s min is -y_0^2/2 when formula is satisfied. This min is smaller than f(y^*) = 0. From cf4fccfd20c5448941ffbdb77cbcda33d159005c Mon Sep 17 00:00:00 2001 From: Yusheng Zhao Date: Mon, 19 May 2025 21:22:38 +0800 Subject: [PATCH 4/4] pkplplplplpl --- hw2/YushengZhao/9_26.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw2/YushengZhao/9_26.jl b/hw2/YushengZhao/9_26.jl index 595ce00..c04969a 100644 --- a/hw2/YushengZhao/9_26.jl +++ b/hw2/YushengZhao/9_26.jl @@ -3,3 +3,5 @@ # on the other hand if the formula is not satisfied, the bound of at least one y_i is 1/2 - y_0/3 <= y_i <= 1/2 +y_0, and the min f(x) is num unsat * y_0^2 - y_0^2/9 + sum_(sat clause) (y_0^2 - y_0^2) - y_0^2/2 + num_unsat * y_0^ / 2*n*9 which is at least 7/18 y_0^2 # using hint, if formula is satisfied, y^* cannot be local minimum because can slide over y_0 axis a little bit, epsilon, and get lower. this is in the neighborhood of y^* because y_i' 's difference from y_i = 1/2 is bounded by the epsilon. And f(x)'s min is -y_0^2/2 when formula is satisfied. This min is smaller than f(y^*) = 0. + +# so x_i means is y_i >= 1/2 - y_0/3 ? \ No newline at end of file