Hello!
I am quite new to the optimization world, as well as Matlab-YALMIP and I am trying to model a parametric maximization problem using YALMIP, which is solved iteratively within an iterative convexification method. However, Matlab crushes even for a very small instance of the problem (N = 3, timesteps = 10, N_scen = 3). Also, for the cases I manage to get an output, each iteration is slow. My parameters are C_max, B, P_h, rho_scen, h_scen, s_j, C and my optimization variables r, l, p, SoE, P_a. I use piecewise linearization to construct logarithms of variables and of expressions containing parameters and variables both in my objective function and constraints. How could I speed up the performance of optimizer? Do you think that there are alternative ways to express the logarithms so to get a solution faster?
Thank you very much, in advance!!
I want to compare the iterative method which solves a convex problem (with gurobi) at each iteration with the performance of a solver that solves directly the non-convex problem. I am adding the code for the method (which sets the parameter values for the toy example) that solves iteratively the problem formulated in prob.m. I would like to solve much larger instances of the problem, that is why I am trying Yalmip and optimizer to avoid defining the problem repeatedly and speed up the solution at each iteration and when the values of parameters change.
Hello Prof. Johan,
Thank you again for your invaluable help and the insights you’ve provided regarding my problem, YALMIP and Gurobi. I really appreciate your support.
I am really sorry for bothering you again, but I would like to ask one more time whether I can use logarithms directly on sdpvars for a problem that is defined to be solved with optimizer or I need to continue with the custom way I was piece-wise approximating logarithms, defining slopes and intercepts.
I realised that the error I was explaining in my previous message was due to the vectorized input I used for the logarithm, so I kept the vectorized expressions only in other constraints and used for-loops for the logarithms like this one (I don't include again code for debugging, just the correspondent lines):
for i = 1:N
for j = 1:N
for t = 1:timesteps
for s = 1:N_scen
if adj_matrix(i, j) == 1
sum(r(i, j, :, t, s)) <= B * log2(1 + (m_scen(i, j, t, s) * p(i, j, t, s)));
end
end
end
end
end
In the above code r, m_scen, p are defined as sdpvars (with r, p being decision variables and m_scen parameters of the problem).
From your previous messaged I understood that if I used the last versions of YALMIP and Gurobi and the parameter 'gurobi.funcnonlinear' equal to 0, this would work as it is, but I still get the error:
“Error using optimizer (line 313)
Parameters are currently only allowed to enter function such as exp, sin etc as exp(a), sin(b) etc.Parameters are currently only allowed to enter function such as exp, sin etc as exp(a), sin(b) etc.”
Is there a point in your explanation which I have not understood? Do I need to include something more so that gurobi does directly pwa of logarithms of expressions containing sdpvars? I just want to know if this is something feasible in Matlab, Yalmip and Gurobi and if yes, how should one write such an expression so that it works.
Thank you once again for your time and guidance and really sorry for the long thread!