Here in my code I defined A vector and B vector for my linear programing, the relationship between them is Ax=<B which A is a inequlity vector and B is a RHS and x is variable. the Error is in photo which i attached .how can I solve it?
Show older comments

this is the way I defined b_ineaualty_sec5 :
[b_ineq_sec5]=load_kw* ones(N_time_slots,1);
and this is the way I defined A_inequality_sec5 :
temp2=eye(N_time_slots);
[A_ineq_sec5]=generate_Cplx_Constraint_format( Vars_size, [3;9],-temp2,temp2);
the relationship between A and b is Ax=<b which A is a inequlity vector and B is a RHS and x is variable. I know the problem is with the size of b and A , but how should I define b ?
and this is vars_size and generate_cplex_format functions:
function [Vars_size]= create_variable_bundle(N_time_slots)
Vars_size=[1;N_time_slots;N_time_slots; N_time_slots; N_time_slots; N_time_slots; N_time_slots;N_time_slots;N_time_slots;N_time_slots;N_time_slots;N_time_slots ];
end
function [A_block]=generate_Cplx_Constraint_format( Vars_size, Var_select,varargin)
total_size=sum(Vars_size);
temp1= tril(ones(numel(Vars_size),numel(Vars_size)))*Vars_size;
temp1(numel(Vars_size))=[];
Start_ind= [0;temp1]+1;
temp2=size( varargin{1} ,1);
A_block=zeros(temp2,total_size);
% A x+ By < b
for i=1: numel(Var_select),
A_block(:,Start_ind(Var_select(i)): Start_ind(Var_select(i))+ Vars_size(Var_select(i))-1 )=varargin{i};
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
