# Solving a Convex and Linear Program

Hello,
I am very new to Matlab and CVX. However, I have a previous programming language background in C and C++. I am trying to write a code using CVX to solve this problem. But got really confused about how I should start.

Here i is the number of vehicles, sample input of i could be 1 to 6.
N is the timeslot.
There is a separate function for r which I didn’t mention but I can write by myself.
here r and b both address i and n. For example, I have the following input
i=[1 2 3 4 5 6]
n=[1…N]
So can anybody please guide me on how to write any constraints?

Do I need to use two for the loop? Any input really appreciated

The first thing you need to do is write out a clear and complete mathematical specification of the optimization problem you want to solve. That specification must make clear what the decision (optimization) variables are, and what the input data is.

The unclear (to me) specification you posted shows \eta and A under the max, implying they are the decision variables. And there are constraints on b, implying the vector b must be a decision variable. And there is no relation provided between b, A, or anything else. Such are the hazards of posting an image of a math problem out of context.

pow_p may come in handy when you write the constraints for b.

Hi Mark,
I have added a few more details. I hope you get it.
That is my confusion, Do you think that is a power or that is a index? Thank you for your time.

I don’t know. You found the model, not me. You should be telling us what the model is, not the other way around. If you have a clearly described convex optimization problem, readers of the forum can try to help you with difficulties entering it into CVX.

Taking a model you don’t understand, and making wild guesses about it, is probably not the most fruitful course of action for learning and beneficially applying optimization.