Integer Linear Programming Problem

I want to model a problem similar to
min x.*wi_T + y.*pump_power; Where wi_T and pump_power are single column vectors of same size as decision variables x and y.
I get the error :"Objective must be a scalar OptimizationExpression or a struct containing a scalar OptimizationExpression."
% n number of chiller PLR values (increasing n increases precision)
n = 100;
%Min PLR (% capacity) for chillers
min_PLR = 1;
%Chiller ouput power (Ton)
chiller_capacity = 1400;
%Total number of equal capacity chillers in plant
l = 3;
%Import Chiller Data as table from excel file
Chiller_Data = readtable('Chiller_Data_varflow.xlsx');
%Get measured PLR from manufacturer for regression
m_PLR = Chiller_Data.PLR;
%Get measured COP from manufacturer for regression
m_COP = Chiller_Data.COP;
%Regression coefficients of COP vs PLR from empirical data
reg_coeff = polyfit(m_PLR,m_COP,4);
%Get measured evaporator flow for regression
Evap_flow = Chiller_Data.ChillerEvapFlow;
%Regression coefficients of evaporator flow from empirical data
flo_reg_coeff = polyfit(m_PLR,Evap_flow,5);
% Create a vector with "n" chiller PLR values
step_size = 100/n;
PLR = (min_PLR:step_size:100);
%Preallocating zeros to vectors before for-loop for speed
COP = zeros(size(PLR));
q_i = zeros(size(PLR));
q_i_kW = zeros(size(PLR));
wi = zeros(size(PLR));
Evap_flow_v = zeros(size(PLR));
for i = 1:1:length(PLR)
%Vector of COP values at each PLR from polynomial curve fitting
COP(i) = polyval(reg_coeff,i);
%Vector of part load chiller capacity at each PLR (Ton)
q_i(i) = chiller_capacity.*(PLR(i)./100);
%Convert q_i units from Ton to kW
q_i_kW(i) = q_i(i).*12000./3415.179;
%Vector of part load chiller input power at each PLR (kW)
wi(i) = q_i_kW(i)./COP(i);
%Evaporator flow vector
Evap_flow_v(i) = polyval(flo_reg_coeff,i);
end
no_chillers = ones(1,100);
l_vector = l.*ones(1,200);
wi_T = transpose(wi);
% Plant demand load (Ton)
P = 420;
% # of pumps in plant
plant_pumps = 3;
% Pump design flowrate (USGPM)
pump_des_flow = 2096;
% Pump design head (ft)
pump_des_h = 150;
% Pump PLR flowrate vector (USGPM)
pump_flow = (PLR/100).*pump_des_flow;
% Pump efficiency
pump_eff = 0.83;
% Motor efficiency
motor_eff = 0.95;
% Pump power consumption (kW)
pump_power = ((pump_flow.^(3).*pump_des_h)./(3956.*pump_eff.*(pump_des_flow.^2).*motor_eff)).*0.7457;
pump_power_T = transpose(pump_power);
% Coefficient for # of active pumps
no_pumps = ones(1,100);
min_power = optimproblem('ObjectiveSense','min');
x = optimvar('x',100,1,'LowerBound',0,'UpperBound',3,'Type','integer');
y = optimvar('y',100,1,'LowerBound',0,'UpperBound',3,'Type','integer');
min_power.Objective = x.*wi_T + y.*pump_power_T;
cons1 = x.*(-q_i) <= -P;
cons2 = x.*Evap_flow_v - y.*pump_flow;
min_power.Constraints.cons1 = cons1;
min_power.Constraints.cons1 = cons1;

 Accepted Answer

min_power.Objective = x' * wi_T + y' * pump_power_T;

More Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Asked:

on 1 Oct 2021

Answered:

on 1 Oct 2021

Community Treasure Hunt

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

Start Hunting!