1
$\begingroup$

Crossposted on Stack Overflow


I am new to CVX and I have to solve the following optimization problem.


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
$\endgroup$
2
  • $\begingroup$ This problem is basically from the Additional Exercises for Convex Optimization Stephen Boyd 2020, Ex 13.7. I have the essence of the problem, but I don't know about this CVX platform, can you please tell where am I going wrong $\endgroup$
    – coolname11
    Commented Nov 4, 2021 at 7:47
  • $\begingroup$ No, but this looks interesting $\endgroup$
    – coolname11
    Commented Nov 4, 2021 at 8:18

0

You must log in to answer this question.