Skip to content

Commit

Permalink
update plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
nhatminh committed Jul 5, 2018
1 parent fa0f499 commit 5a90454
Show file tree
Hide file tree
Showing 27 changed files with 20 additions and 10 deletions.
Binary file modified data.h5
Binary file not shown.
Binary file modified figs/Heterogeneous/Sub1_N.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Heterogeneous/Sub1_T.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Heterogeneous/Sub1_f.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Heterogeneous/Sub2_Tau.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Heterogeneous/Sub2_p.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Heterogeneous/Sub3_eq.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Heterogeneous/Sub3_obj.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Homogeneous/Sub1_N.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Homogeneous/Sub1_T.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Homogeneous/Sub1_f.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Homogeneous/Sub2_Tau.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Homogeneous/Sub2_p.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Homogeneous/Sub3_eq.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Homogeneous/Sub3_obj.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Sub1_N.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Sub1_T.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Sub1_f.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Sub2_Tau.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Sub2_p.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Sub3_eq.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figs/Sub3_obj.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion julia/Main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function main()

Theta, Theta1 = zeros(Numb_kaps), zeros(Numb_kaps)
Obj, Obj1 = zeros(Numb_kaps), zeros(Numb_kaps)
Obj_E, Obj_T = zeros(Numb_kaps), zeros(Numb_kaps)
d_eta = zeros(Numb_kaps)

# println("Numb_kaps: ", Numb_kaps)
Expand All @@ -55,7 +56,7 @@ function main()

### Sub3 ###
Theta[k], Obj[k] = Solving_sub_prob3(T_cmp[k],E_cmp[k],T_com[k],E_com[k])
Theta1[k], Obj1[k], d_eta[k] = Solving_sub3(T_cmp1[k],E_cmp1[k],T_com1[k],E_com1[k])
Theta1[k], Obj1[k], Obj_E[k], Obj_T[k], d_eta[k] = Solving_sub3(T_cmp1[k],E_cmp1[k],T_com1[k],E_com1[k])
# println("\n---->> Check Sub3 Solution: ", check([Theta], [Theta1]))

# ### Global ###
Expand Down
18 changes: 13 additions & 5 deletions julia/Plots_Figs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,27 @@ function plot_sub3_cvx(kaps, Theta, Theta1, Obj, Obj1, T_cmp1, E_cmp1, T_com1, E
# savefig(string(folder,"Sub3_obj.png"))

x = collect(1.e-5:0.001:0.99)
obj = zeros(size(x)[1])
id = 9
obj = zeros(size(x)[1])
glob_cost_iter = zeros(size(x)[1])
glob_numb_iter = zeros(size(x)[1])
id = 19
println("Convex for kappa: ", kaps[id])
for i=1:size(x)[1]
obj[i] = 1/(1 - x[i])* (E_com1[id] - log(x[i])*E_cmp1[id] + kaps[id] * (T_com1[id] - log(x[i])*T_cmp1[id]))
glob_cost_iter[i] = E_com1[id] - log(x[i])*E_cmp1[id] + kaps[id] * (T_com1[id] - log(x[i])*T_cmp1[id])
glob_numb_iter[i] = 1/(1 - x[i])
# obj[i] = obj_E[i] + obj_T[i]
end
plot(x, obj,linestyle="-",color="k", label=string("\$\\kappa\$ =", kaps[id]))
plot(x, obj,linestyle="-",color="k", label=string("Objective: \$\\kappa\$ =", kaps[id]))
plot(x, glob_cost_iter,linestyle="--",color=colors[2], label=string("\$E_{glob} + \\kappa * T_{glob}\$"))
plot(x, glob_numb_iter,linestyle="--",color=colors[3], label=string("\$ 1/(1 - \\Theta)\$"))
# println(x)
plot(Theta1[id], Obj1[id],color="r", marker=markers[1], markersize=marker_size)
plot(Theta1[id], Obj1[id],color="r", marker=markers[2], markersize=marker_size)

legend(loc="best",fontsize=legend_fontsize-2)
xlabel("\$\\Theta\$",fontsize=label_fontsize1+1)
ylabel("Objective",fontsize=label_fontsize1+1)
# ylabel("Objective",fontsize=label_fontsize1+1)
yscale("log")
tight_layout(pad=0.5, w_pad=0.5, h_pad=0.5)
savefig(string(folder,"Sub3_obj.png"))
println("Theta: ", minimum(Theta1), " - ", maximum(Theta1))
Expand Down
4 changes: 2 additions & 2 deletions julia/Setting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ S_n = 10e3 *8 #10KB, weight params size (-> bits), and gradient => 10K nats
### COMMUNICATIONS PARAMS ###
Ptx_Max = 1.
Ptx_Min = 0.1
N0 = 1e-12 # -> Decrease BW -> Increase Theta
BW = 20e6 #Mhz -> Increase BW -> Increase Theta
N0 = 1e-10 # -> Decrease BW -> Increase Theta
BW = 1e6 #Mhz -> Increase BW -> Increase Theta

Dist_min = 2 #2m
Dist_max = 50 #50m
Expand Down
5 changes: 3 additions & 2 deletions julia/Solving1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,8 @@ function Solving_sub3( T_cmp, E_cmp, T_com, E_com)
println("Roots: ", Thetas)

Obj = 1/(1 - rs_Theta) * (E_com - log(rs_Theta)*E_cmp + kappa * (T_com - log(rs_Theta)*T_cmp))

Obj_E = 1/(1 - rs_Theta) * (E_com - log(rs_Theta)*E_cmp)
Obj_T = 1/(1 - rs_Theta) *(T_com - log(rs_Theta)*T_cmp)
if (DEBUG > 0)
println("fx: ", fx(rs_Theta))
println("Theta: ", rs_Theta)
Expand All @@ -446,5 +447,5 @@ function Solving_sub3( T_cmp, E_cmp, T_com, E_com)

# println("Test sub3:", abs(log(rs_Theta) + 1/rs_Theta - 1/eta))

return rs_Theta, Obj, 1/eta
return rs_Theta, Obj, Obj_E, Obj_T, 1/eta
end
Binary file modified setting.h5
Binary file not shown.

0 comments on commit 5a90454

Please sign in to comment.