Formulating problem in CVX

조회 수: 5 (최근 30일)
Abdual Ahad
Abdual Ahad 2021년 11월 8일
I am new to CVX and I have to solve the following optimization problem.
I have written the code for it and also changed the equalities to make it convex but I think there is some problem in my code which I am not able to figure out.
clc; clear all;
m=10;
x_final = 12;
v_final = 2;
v_max = 10;
a_max = 2;
c_loss = 2;
h = 0.1;
T = 5;
r = T/h;
cvx_begin
variables p(1,r-1) v(1,r) x(1,r) k(1,r) p_d(1,r-1) p_b(1,r-1) a(1,r-1);
minimize(h*sum(p))
v(1) == 0;
x(1) == 0;
v >= 0;
a <= a_max;
v <= v_max;
for i=1:r-1
v(i+1) == v(i) + (h*a(i));
x(i+1) == x(i) + ((h/2)*(v(i) + v(i+1)));
k(i) >= (m*(v(i)^2))/2;
p_d(i) >= c_loss*(pow_abs(v(i),3));
k(i+1) == (h*(p(i) - p_b(i) - p_d(i))) + k(i);
end
x(end) >= x_final;
v(end) <= v_final;
cvx_end
It has been written in MATLAB 2020b, can any point where I am going wrong, this is the output I get when I run it
Trivial infeasibilities detected; solution determined analytically.
Status: Unbounded
Optimal value (cvx_optval): -Inf

답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by