# How do I solve this Optimization problem?

Optimization of a simple expansion problem

minimise: $$\sum_{t=1}^{5}\left[\sum_{i=1}^{2}x_{i,t}CC_i\left(\frac{1+EIC}{1+r}\right)^t+UE_t*C_{UE}\right]$$ subject to: $$0 \leq x_{i,t} \leq 5 \\ ED_B(I+\alpha)^t=\sum_{i=1}^{2}\sum_{j=1}^{t}x_{ij}G_{ij}+UE_t\\ ED_B,\alpha\in\Bbb{R}\\ UE=[\;4.5,4.8,4.2,4.0,5.0\;]\;kWH\\ C_{UE}=0.05 \\ (Escalation\;in\;CC)\;EIC=4\;\% \\ (Annual\;Discount)\;r=5\;\%$$

I want to minimize a cost function accumulating over 5 years with some constraints on energy balance and bounds on the integer variables. It could be a mixed-integer problem.

How to formulate in MatLab or any other tools that I can use to write and solve.

CVX tutorial for such a problem is highly appreciated.

Problem

• Welcome to OR.SE. You could try using many of the commercial or open-source solvers like CPLEX, Gurobi, CVX, etc. You will need to start with one of them and if you have any issue ask your question again. :) May 14, 2020 at 15:56
• It is good practice to make clear what symbols are input data and what the optimization (a.k.a. decision0 variables are, rather than making the reader guess. Which, if any, things other than $x_{i,j}$ are optimization variables? Which, if any, of the optimization variables are constrained to be integer? May 15, 2020 at 2:33
• That is not linear or even convex. Right? May 15, 2020 at 5:43

## 1 Answer

Here is the model you can write using LocalSolver, our global optimization solver. Please note that LocalSolver is a commercial software like MATLAB. Nevertheless, you can benefit from free trial or academic licenses.

function model() {
x[i in 1..2][t in 1..5] <- int(0, 5);
EDB <- float(-1e3, 1e3);
alpha <- float(-1e3, 1e3);

for[t in 1..5] {
constraint EDB * pow(1 + alpha, t) == sum[i in 1..2][j in 1..t](x[i][j] * G[i][j]) + UE[t];
}

minimize sum[t in 1..5][i in 1..2](x[i][t] * CC[i] * pow((1 + EIC) / (1 + r), t) + UE[t] * Cue);
}


To make it work, you have to add the input data like this:

function input() {
// we skip t = 0
UE = {0, 4.5, 4.8, 4.2, 4.0, 5.0};
Cue = 0.05;
EIC = 0.04;
r = 0.05;

// Dummy data for G_ij
G = {
{}, //skip index 0
{0, 0.42, 0.63, 0.18, 0.78, 0.44},
{0, 0.06, 0.65, 0.92, 0.71, 0.98}
};

// Dummy data for CC_i
CC = {0, 0.5, 0.5};
}


As shown above, we have tried to complete the missing data with some values. Using this data, the model is unfeasible (no surprise).