formulating the objective function for MILP

I have an optimization problem as follows:
Min ((C_1*x_1)+(C_2*x_2)+(C_3*x_3)+(C_4*min(X))).
s.t "some constraints which I don't think they are relevant to my question at this point, All linear of course"
x_1, x_2, and x_3, as well as all "C"s, are scalars
"X" in that last term is a vector. I want to get the minimum value of that vector into the objective function but I couldn't work it out
Any suggestion?
Abdullah

Answers (3)

Perhaps you can try solving three different problems, one with C_4 multiplying x_1, one multiplying x_2, and one multiplying x_3. Then take the appropriate solution, the solution that has the multiplier of C_4 as the minimum.
Of course, this might not work, but if it does then I think you are done.
Alan Weiss
MATLAB mathematical toolbox documentation

3 Comments

I think my question was not introduced right
"x"s are the variables and "C"s are just coefficients
So I don't see the point of multiplying C_4 with the other variables?! By the way, the vector X is defined as follows
X=[x_4;x_5;...;x_8760] I know this is a very large matrix, but I couldn't formulate my problem any other way
Alan Weiss
Alan Weiss on 31 Aug 2016
Edited: Alan Weiss on 31 Aug 2016
I am not sure that I understand you even now, because you say that this is an MILP, but I see no integer constraints.
Even so, I suppose that you could try using fmincon, but it might not work because the objective is not smooth. I suppose that the constraints that you do not mention keep the problem in a bounded region.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
My god I'm so bad at writing questions
x_1, x_2 and x_3 are integers and x_4,...,xn are continuous variables
Thanks Alan for your constant response

Sign in to comment.

Matt J
Matt J on 31 Aug 2016
Edited: Matt J on 31 Aug 2016
If C_4<0, the problem can be reformulated linearly as follows
Min ((C_1*x_1)+(C_2*x_2)+(C_3*x_3)+(C_4*z)).
s.t. all your original constraints and
z<=x_4
z<=x_5
...
z<=x_8760
As a result of the above constraints, z<=min(X). If C_4<0, this must be satisfied with equality at the optimum, because the optimizer must try to push z as close as it can get to +inf.
If C_4>0, then the solution lies at min(X)=-inf unless you have constraints in place to prevent that. We would have to see those constraints to decide how to modify the above solution.

3 Comments

%
tf=5e3;
L="an 8760 by 1 vector"
C_tank=300;
vec_tank=repmat(C_tank,[N*24,1]);
slack_coe_zeros=zeros((N*24)-1,3);
slack_coe=zeros((N*24)-1,N*24); % Grid energy coeficients
m=2;
for i=1:1:(N*24)-1
for j=1:1:m
slack_coe(i,j)=1;
end
m=m+1;
end
slack=[slack_coe_zeros,slack_coe];
coe=eye(N*24);
f_5=[C_pv; C_wt; C_csp; vec_tank];
a_9=slack; b_9=zeros((N*24)-1,1);
a_10=[P_pv_year/tf, P_wt_year/tf, P_csp_year/tf, coe]; b_10=L;
f=f_5;
intcon=[1,2,3]; % Variable type
A=a_9; b=b_9; % Inequality constraint
Aeq=a_10; beq=b_10; % Equality constraint
lb=[zeros(3,1);repmat(-inf,[N*24,1])]; % Lower bounds
ub=inf((N*24)+3,1); % Upper bounds
[x, fval]=intlinprog(f,intcon,A,b,Aeq,beq,lb,ub);
This is the code I'm trying to execute. I'm not quite sure if it is easy to read or not. Of course, this is not what I want to do exactly. As previously mentioned I want the fourth term of the objective function "f_5" to take the minimum value from the whole vector
I can't tell from the code how C_4 would be defined in the actual problem.

Sign in to comment.

Matt J
Matt J on 1 Sep 2016
Edited: Matt J on 1 Sep 2016
You could use ga() to solve the problem instead of trying to pose it as an MILP, but you would have to eliminate the equality constraints, since ga cannot simultaneously process equality and integer constraints.
You can eliminate the equality constraints from the problem by using them to solve for some of the variables in terms of the others. If you have the patience to read through a really long thread on this, see here
But it's basically very simple. The equalities
Aeq*x=beq
should have Aeq full row rank, otherwise some of your equality constraints are redundant. Since Aeq is full rank, the equalties can be partitioned, possibility after re-ordering the variables, as
[P,Q]*[xp;xq]=beq
where P is a square nonsingular sub-matrix and x=[xp;xq] is a corresponding partition of the unknowns x. Then the sub-partition xp can be written in terms of xq as
xp=P\(beq-Q*xq)
Thus, you can eliminate the variables xp by using the above substitution formula to replace them with an expression in xq everywhere in your problem. This leads to a reformulation of the entire problem in terms of xq only and no equality constraints (just inequalities).

Categories

Community Treasure Hunt

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

Start Hunting!