add conditional constrain in optimization

if a=0 then q=0
if a=1 then q=24;
if a=2 then q=32;
if a=3 then q=44;

how to write this as constrain for optimization problem?

5 Kommentare

q=[0 24 32 44];
out = q(a+1)
Fathima
Fathima am 27 Feb. 2023
Bearbeitet: Fathima am 27 Feb. 2023
@Dyuman Joshi what if a depends on time t ?
I tried to give
a = sdpvar(T, 1);
out=q(a(t)+1)
but error : Unable to use a value of type sdpvar as an index.
Rik
Rik am 27 Feb. 2023
Can you provide an example? This may require creating a custom function.
Torsten
Torsten am 27 Feb. 2023
Which optimizer do you use ?
Is a defined to be integer ?
Is q defined to be integer ?
Are a and q solution variables ?
Fathima
Fathima am 28 Feb. 2023
Bearbeitet: Fathima am 28 Feb. 2023
@Torsten @Rik I will explain my problem more clearly.. I have 3 pumps so number of pumps 'a' working at the time t denoted by a[t] can take values =0,1,2,3. Now supply of water at time t denoted by Q[t] depends on a[t] that is given by if a[t]=0 then Q[t]=0 if a[t]=1 then Q[t]=24; if a[t]=2 then Q[t]=32; if a[t]=3 then Q[t]=44;
Objective is to minimize number of pumps used at time t
My doubt it how to implement this conditional constraint in MATLAB ?

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Torsten
Torsten am 28 Feb. 2023
Bearbeitet: Torsten am 28 Feb. 2023

0 Stimmen

Define x_it be the decision variable if pump i is active at time t. That means x_it can take values 0 and 1 and equals 0 of pump i is off at time t and equals 1 if pump i is on at time t.
Then your problem somehow looks like
min: sum_t (x1t + x2t + x3t)
24*x1t + 32*x2t + 44*x3t >= amount of water needed at time t (t=1,...,T)
0 <= x_it < = 1
x_it integer
You can use "intlinprog" to solve.

35 Kommentare

@Torsten I TRIED BUT GOT ERROR
% Load data from excel sheet
t= xlsread('mathlab_water_tank_3pipe.xlsx', 'Sheet1', 'A1:A951');
Q_d=xlsread('mathlab_water_tank_3pipe.xlsx', 'Sheet1', 'B1:B951');
% Define constants
A = 40; %AREA OF TANK
Hmax = 7; %MAX HEIGHT
% Define optimization variables
n = length(t);
x = intvar(3, n, 'Binary');
Q_s = sum(repmat([24; 32; 44], 1, n) .* x);
% Define constraints
constraints = [];
for i = 1:n
constraints = [constraints, h(i) <= Hmax]; %UPPERBOUND FOR HEIGHT
constraints = [constraints, A*(h(i+1)-h(i)) == Q_s(i)-Q_d(i)]; %ADDED 2ND CONSTRAINT
end
% Define objective function
obj = sum(x);
% Solve optimization problem
options = optimoptions('intlinprog', 'Display', 'iter');
sol = optimize(constraints, obj, options);
% Display results
if sol.problem == 0
disp('Optimization successful!');
disp(['Minimum value of objective function: ', num2str(value(obj))]);
disp(['Optimal values of x: ', num2str(value(x))]);
disp(['Optimal values of h: ', num2str(value(h))]);
else
disp('Optimization failed.');
end
ERROR:
Error using sdpvar (line 254)
Matrix type "Binary" not supported
Error in intvar (line 22)
sys = sdpvar(varargin{:});
Error in chanceconstraint_tank_3pipe_ (line 12)
x = intvar(3, n, 'Binary');
x = optimvar('x',3,n,'LowerBound',0,'UpperBound',1,'Type','integer');
>> chanceconstraint_tank_3pipe_
Error using == (line 15)
Error using -
Conversion to optim.problemdef.OptimizationExpression from sdpvar is not possible.
Error in chanceconstraint_tank_3pipe_ (line 19)
constraints = [constraints, A*(h(i+1)-h(i)) == Q_s(i)-Q_d(i)];
Torsten
Torsten am 28 Feb. 2023
Bearbeitet: Torsten am 28 Feb. 2023
Please look this video to get accustomed to the problem-based approach in optimization.
Follow the steps in your problem setup.
Could you include the mathematical formulation of your optimization problem for comparison ?
Fathima
Fathima am 28 Feb. 2023
Bearbeitet: Fathima am 28 Feb. 2023
Mathematical formula is
Minimize number of pump working at time t i.e minimize a[t]
Subjected to constrain A*dh/dt=Q_s(t)-Q_d(t)
where Q_s(t)=0 if a[t]=0
=24 if a[t]=1
=32 if a[t]=2
=44 if a[t]=3
h(t)<=H_max
h(t)>0
Fathima
Fathima am 28 Feb. 2023
here H_max is given , area A is given , Q_d(t) is given.
Torsten
Torsten am 28 Feb. 2023
As far as I understand your problem, this is the first step to solve your problem:
A mathematical formulation.
min: sum_{t=1}^{t=T} (x_1t + 2*x2t + 3*x3t)
under the constraints
A * (h_(t+1) - h_t) = deltaT * ( (x_1t*24 + x2t*32 + x3t*44) - Qd(t)) (t=1,...T)
x1t + x2t + x3t <= 1 (t=1,...,T)
0 <= h(t) <= Hmax (t=1,...,T)
0 <= x1t, x2t, x3t <= 1 (t=1,...,T)
x1t,x2t,x3t integer (t=1,...,T)
Now use "intlinprog" to solve with the help of the video.
Fathima
Fathima am 28 Feb. 2023
@Torsten thanks a lot ... got it 👍🙌
Torsten
Torsten am 28 Feb. 2023
Bearbeitet: Torsten am 28 Feb. 2023
Note that in the above formulation,
x_1t = 0, x_2t = 0, x_3t = 0 means: no pump is active at time t
x_1t = 1, x_2t = 0, x_3t = 0 means: one pump is active at time t
x_1t = 0, x_2t = 1, x_3t = 0 means: two pumps are active at time t
x_1t = 0, x_2t = 0, x_3t = 1 means: three pumps are active at time t
This differs from my former definition of the x_it.
I think it will also be possible to formulate the problem with x_it = 0 or 1 depending on whether pump i is active at time t or not, but I did no longer follow this path of thought.
And are you sure you only want to minimize the sum of the pumps used and not the total energy consumption ? Because the three pumps seem to differ in power demand.
Thus a more flexible formulation would be
min: sum_{t=1}^{t=T} a_t
s.c.
a_t = sum_{i=1}^{i=I} P_i*x_it (t = 1,...,T) % total Power consumption at time t
Q_t = sum_{i=1}^{i=I} Q_i*x_it (t = 1,...,T) % total water supply at time t
A*(h(t+1)-h(t)) = deltaT * (Q_t - Q_d(t)) (t = 1,...,T) % variation of Tank height
0 <= h(t) <= Hmax (t = 1,...,T)
0 <= x_it <= 1 (i = 1,...,I ; t=1,...,T)
x_it integer (i = 1,...,I ; t=1,...,T) % = 1 if pump i is active at time t, = 0 else
Fathima
Fathima am 1 Mär. 2023
@Torsten i dont understand why you multiplied by deltaT ? dh/dt means change in height with respect to time so dh/dt will be same as h[t+1]-h[t] right?
Fathima
Fathima am 1 Mär. 2023
@Torsten as you have asked of objective , i wanted to minimize power consumption. but did not know how to connect power to decision variables. so i minimized number of pumps working at time t since its directly propotional to power consumption. if number of pumps working increases , power also will increase.. so thats the reason I took minimize number of pumps as objective.
x0t = 1; %no pump working
if h<6.8 && h>=4
x1t = 1; %one pump working
elseif h<4 && h>=2.3
x2t=1;
elseif h<2.3
x3t = 1;
end
how to add this as constraint?
Torsten
Torsten am 1 Mär. 2023
Bearbeitet: Torsten am 1 Mär. 2023
dh/dt means change in height with respect to time so dh/dt will be same as h[t+1]-h[t] right?
No. dh/dt has unit m/s, h[t+1]-h[t] has unit m.
as you have asked of objective , i wanted to minimize power consumption. but did not know how to connect power to decision variables. so i minimized number of pumps working at time t since its directly propotional to power consumption. if number of pumps working increases , power also will increase.. so thats the reason I took minimize number of pumps as objective.
The pumps you use seem to differ because a[t] does not increase linearily. Your approach to just add the pumps in action is only feasible if a[0] = 0, a[1] = 24, a[2] = 48 and a[3] = 72 and the power they consume is equal . So you have to take into account how much power each individual pump consumes and how much water it is able to supply.
x0t = 1; %no pump working
if h<6.8 && h>=4
x1t = 1; %one pump working
elseif h<4 && h>=2.3
x2t=1;
elseif h<2.3
x3t = 1;
end
how to add this as constraint?
If you add this as constraint, you do not need an optimizer any longer because you prescribe the variables "intlinprog" would solve for. So why do you want to add this constraint ? Since you used the constraints 0 <= h(t) <= Hmax, "intlinprog" will automatically adjust the number of pumps for each time such that water remains in the reservoir tank while at the same time minimum power is used to supply sufficient water. If there does not exist a control strategy for the liquid level such that 0 <= h(t) <= Hmax can be satisfied over the time period for your problem, "intlinprog" will give you a message that your problem is not feasible. But you don't need to include control mechanisms on your own as you try above - the solver will automatically find the best strategy.
Fathima
Fathima am 3 Mär. 2023
https://in.mathworks.com/help/reinforcement-learning/ug/water-distribution-scheduling-system.html
This is a similar kind of problem which I want to do in optimization..
Torsten
Torsten am 3 Mär. 2023
But this is a completely different approach to the problem. You must decide which approach you want to use. If you know water demand for future periods in advance, the above approach using "intlinprog" is superior to the neural network approach. If water demand is uncertain, then it makes sense to first train your system with demand data from the past and then use the trained system to take decisions in similar situations in the future (at least this is how I understand the approach used in the link you supplied).
Fathima
Fathima am 3 Mär. 2023
@Torsten yes that approach is different. what I was trying is if I can do this problem with optimization or not if water demand is known.
Fathima
Fathima am 3 Mär. 2023
I took data from mathwork model(demand,area,supply). and tried to do by intlinprog but output is different(hight,number of pumps working that is x0,x1,x2,x3 values). But I think sometging went wrong in my calculation since in the output , I noticed number of pumps working is not depended on hight.. but in mathwork model its given number of pumps to work if height is between some range.. that is not reflecting in my model after optimization.
Torsten
Torsten am 3 Mär. 2023
Bearbeitet: Torsten am 3 Mär. 2023
what I was trying is if I can do this problem with optimization or not if water demand is known.
Yes, you can. But did you make MATLAB code for the model ? I thought you didn't manage it until now.
Fathima
Fathima am 4 Mär. 2023
Bearbeitet: Fathima am 4 Mär. 2023
% Load data from excel sheet
time= xlsread('mathlab_water_tank_3pipe.xlsx', 'Sheet1', 'A1:A951');
Qd=xlsread('mathlab_water_tank_3pipe.xlsx', 'Sheet1', 'B1:B951');
% Define the constants and parameters of the problem
T = length(time);
A = 40;
Hmax = 7;
% Define the decision variables
x0 = optimvar('x0', T, 'LowerBound', 0, 'UpperBound', 1, 'Type', 'integer');
x1 = optimvar('x1', T, 'LowerBound', 0, 'UpperBound', 1, 'Type', 'integer');
x2 = optimvar('x2', T, 'LowerBound', 0, 'UpperBound', 1, 'Type', 'integer');
x3 = optimvar('x3', T, 'LowerBound', 0, 'UpperBound', 1, 'Type', 'integer');
h = optimvar('h', T, 'LowerBound', 0, 'UpperBound', Hmax);
% Define the objective function
obj = sum(x0+x1+x2+x3);
% Define the linear constraints
constr1 = optimconstr(T);
constr2 = optimconstr(T);
for t = 1:T-1
constr1(t) = A*(h(t+1) - h(t)) == 0.1*(( x0(t)*0+x1(t)*164 + x2(t)*279 + x3(t)*344) - Qd(t));
end
for t = 1:T
constr2(t) = x0(t)+x1(t)+x2(t)+x3(t)==1;
end
% Set up the problem and solve it using intlinprog
problem = optimproblem('Objective', obj, 'Constraints', [constr1,constr2]);
[sol, fval, exitflag] = solve(problem);
x1val=value(x1);
% Display the optimal solution and the objective value
disp('Optimal solution:');
disp(sol);
disp('Objective value:');
disp(fval);
disp('Objective value of x1(t)');
disp(x1val)
this is my code. Qd is demand which I took from the mathwork model which is random demand.
and time is 0,0.1,0.2,...... etc..
Here objective I took is min sum(x0+x1+x2+x3) as it was said in mathwork model.... I just was trying to do the same model with optimization... But answer is coming different... In mathwork model its given number of pumps to work if height is between some range.. that is not reflecting in my model after optimization. Thats the reason I felt someting went wrong in what I did .... Actually after optimization number of pumps working should be automatically between some hight bound ... In mathwork model they have explicitly given (dont know why .. may be for Reinforcement learning .. I have no idea about that method...) .
Fathima
Fathima am 4 Mär. 2023
But I believe that we can do it in optimization... but why we are not geting correct answer is the question need to be solved... I have taken same inputs , objective function, constraints . Only change is that i dint explicitly mention the height bound for number of pumps to work.... but since you have mentioned it will be automatically done by intlinprog, I have not given that constraint.... also even if I plan to give that constraint, I dont know how to give it... because its a piecewise function.
Torsten
Torsten am 4 Mär. 2023
Bearbeitet: Torsten am 4 Mär. 2023
If you include the Excel files with time and demand data, I'll take a look.
You did not set the initial liquid level h(1) in the tank - this is of course necessary to give the system an initial condition.
For this, you simply add a constraint
h(1) == H0;
where H0 is a numerical value defined somewhere in your code with 0 <= H0 <= Hmax.
Torsten
Torsten am 4 Mär. 2023
Bearbeitet: Torsten am 4 Mär. 2023
Try this. It takes too long here to finish, so I cannot tell whether your output part makes sense.
rng("default")
num_days = 3;
[WaterDemand T_max] = generateWaterDemand(num_days);
time = WaterDemand.time;
Qd = WaterDemand.Data;
plot(time,Qd)
problem = optimproblem;
% Define the constants and parameters of the problem
T = length(time);
A = 40;
Hmax = 7;
H0 = 3.5;
% Define the decision variables
x1 = optimvar('x1', T-1,1, 'LowerBound', 0, 'UpperBound', 1, 'Type', 'integer');
x2 = optimvar('x2', T-1,1, 'LowerBound', 0, 'UpperBound', 1, 'Type', 'integer');
x3 = optimvar('x3', T-1,1, 'LowerBound', 0, 'UpperBound', 1, 'Type', 'integer');
h = optimvar('h', T,1, 'LowerBound', 0, 'UpperBound', Hmax);
% Define the objective function
problem.Objective = sum(x1+2*x2+3*x3);
% Define the linear constraints
constr1 = optimconstr(T-1);
constr2 = optimconstr(T-1);
constr1(1) = h(1) == H0;
for t = 2:T-1
constr1(t) = A*(h(t+1) - h(t)) == (( x1(t)*164 + x2(t)*279 + x3(t)*344) - Qd(t));
end
for t = 1:T-1
constr2(t) = x1(t)+x2(t)+x3(t)<=1;
end
problem.Constraints.constr1 = constr1;
problem.Constraints.constr2 = constr2;
show(problem)
OptimizationProblem : Solve for: h, x1, x2, x3 where: x1, x2, x3 integer minimize : x1(1) + x1(2) + x1(3) + x1(4) + x1(5) + x1(6) + x1(7) + x1(8) + x1(9) + x1(10) + x1(11) + x1(12) + x1(13) + x1(14) + x1(15) + x1(16) + x1(17) + x1(18) + x1(19) + x1(20) + x1(21) + x1(22) + x1(23) + x1(24) + x1(25) + x1(26) + x1(27) + x1(28) + x1(29) + x1(30) + x1(31) + x1(32) + x1(33) + x1(34) + x1(35) + x1(36) + x1(37) + x1(38) + x1(39) + x1(40) + x1(41) + x1(42) + x1(43) + x1(44) + x1(45) + x1(46) + x1(47) + x1(48) + x1(49) + x1(50) + x1(51) + x1(52) + x1(53) + x1(54) + x1(55) + x1(56) + x1(57) + x1(58) + x1(59) + x1(60) + x1(61) + x1(62) + x1(63) + x1(64) + x1(65) + x1(66) + x1(67) + x1(68) + x1(69) + x1(70) + x1(71) + 2*x2(1) + 2*x2(2) + 2*x2(3) + 2*x2(4) + 2*x2(5) + 2*x2(6) + 2*x2(7) + 2*x2(8) + 2*x2(9) + 2*x2(10) + 2*x2(11) + 2*x2(12) + 2*x2(13) + 2*x2(14) + 2*x2(15) + 2*x2(16) + 2*x2(17) + 2*x2(18) + 2*x2(19) + 2*x2(20) + 2*x2(21) + 2*x2(22) + 2*x2(23) + 2*x2(24) + 2*x2(25) + 2*x2(26) + 2*x2(27) + 2*x2(28) + 2*x2(29) + 2*x2(30) + 2*x2(31) + 2*x2(32) + 2*x2(33) + 2*x2(34) + 2*x2(35) + 2*x2(36) + 2*x2(37) + 2*x2(38) + 2*x2(39) + 2*x2(40) + 2*x2(41) + 2*x2(42) + 2*x2(43) + 2*x2(44) + 2*x2(45) + 2*x2(46) + 2*x2(47) + 2*x2(48) + 2*x2(49) + 2*x2(50) + 2*x2(51) + 2*x2(52) + 2*x2(53) + 2*x2(54) + 2*x2(55) + 2*x2(56) + 2*x2(57) + 2*x2(58) + 2*x2(59) + 2*x2(60) + 2*x2(61) + 2*x2(62) + 2*x2(63) + 2*x2(64) + 2*x2(65) + 2*x2(66) + 2*x2(67) + 2*x2(68) + 2*x2(69) + 2*x2(70) + 2*x2(71) + 3*x3(1) + 3*x3(2) + 3*x3(3) + 3*x3(4) + 3*x3(5) + 3*x3(6) + 3*x3(7) + 3*x3(8) + 3*x3(9) + 3*x3(10) + 3*x3(11) + 3*x3(12) + 3*x3(13) + 3*x3(14) + 3*x3(15) + 3*x3(16) + 3*x3(17) + 3*x3(18) + 3*x3(19) + 3*x3(20) + 3*x3(21) + 3*x3(22) + 3*x3(23) + 3*x3(24) + 3*x3(25) + 3*x3(26) + 3*x3(27) + 3*x3(28) + 3*x3(29) + 3*x3(30) + 3*x3(31) + 3*x3(32) + 3*x3(33) + 3*x3(34) + 3*x3(35) + 3*x3(36) + 3*x3(37) + 3*x3(38) + 3*x3(39) + 3*x3(40) + 3*x3(41) + 3*x3(42) + 3*x3(43) + 3*x3(44) + 3*x3(45) + 3*x3(46) + 3*x3(47) + 3*x3(48) + 3*x3(49) + 3*x3(50) + 3*x3(51) + 3*x3(52) + 3*x3(53) + 3*x3(54) + 3*x3(55) + 3*x3(56) + 3*x3(57) + 3*x3(58) + 3*x3(59) + 3*x3(60) + 3*x3(61) + 3*x3(62) + 3*x3(63) + 3*x3(64) + 3*x3(65) + 3*x3(66) + 3*x3(67) + 3*x3(68) + 3*x3(69) + 3*x3(70) + 3*x3(71) subject to constr1: h(1) == 3.5 -40*h(2) + 40*h(3) - 164*x1(2) - 279*x2(2) - 344*x3(2) == -48.2896 -40*h(3) + 40*h(4) - 164*x1(3) - 279*x2(3) - 344*x3(3) == -9.349341 -40*h(4) + 40*h(5) - 164*x1(4) - 279*x2(4) - 344*x3(4) == -65.66879 -40*h(5) + 40*h(6) - 164*x1(5) - 279*x2(5) - 344*x3(5) == -61.61796 -40*h(6) + 40*h(7) - 164*x1(6) - 279*x2(6) - 344*x3(6) == -89.87702 -40*h(7) + 40*h(8) - 164*x1(7) - 279*x2(7) - 344*x3(7) == -268.9249 -40*h(8) + 40*h(9) - 164*x1(8) - 279*x2(8) - 344*x3(8) == -452.3441 -40*h(9) + 40*h(10) - 164*x1(9) - 279*x2(9) - 344*x3(9) == -332.8753 -40*h(10) + 40*h(11) - 164*x1(10) - 279*x2(10) - 344*x3(10) == -193.2444 -40*h(11) + 40*h(12) - 164*x1(11) - 279*x2(11) - 344*x3(11) == -142.8807 -40*h(12) + 40*h(13) - 164*x1(12) - 279*x2(12) - 344*x3(12) == -168.5296 -40*h(13) + 40*h(14) - 164*x1(13) - 279*x2(13) - 344*x3(13) == -152.8583 -40*h(14) + 40*h(15) - 164*x1(14) - 279*x2(14) - 344*x3(14) == -149.2688 -40*h(15) + 40*h(16) - 164*x1(15) - 279*x2(15) - 344*x3(15) == -180.014 -40*h(16) + 40*h(17) - 164*x1(16) - 279*x2(16) - 344*x3(16) == -137.0943 -40*h(17) + 40*h(18) - 164*x1(17) - 279*x2(17) - 344*x3(17) == -166.0881 -40*h(18) + 40*h(19) - 164*x1(18) - 279*x2(18) - 344*x3(18) == -285.7868 -40*h(19) + 40*h(20) - 164*x1(19) - 279*x2(19) - 344*x3(19) == -374.6104 -40*h(20) + 40*h(21) - 164*x1(20) - 279*x2(20) - 344*x3(20) == -262.9746 -40*h(21) + 40*h(22) - 164*x1(21) - 279*x2(21) - 344*x3(21) == -127.787 -40*h(22) + 40*h(23) - 164*x1(22) - 279*x2(22) - 344*x3(22) == -59.78558 -40*h(23) + 40*h(24) - 164*x1(23) - 279*x2(23) - 344*x3(23) == -62.45647 -40*h(24) + 40*h(25) - 164*x1(24) - 279*x2(24) - 344*x3(24) == -49.69966 -40*h(25) + 40*h(26) - 164*x1(25) - 279*x2(25) - 344*x3(25) == -36.93676 -40*h(26) + 40*h(27) - 164*x1(26) - 279*x2(26) - 344*x3(26) == -40.88701 -40*h(27) + 40*h(28) - 164*x1(27) - 279*x2(27) - 344*x3(27) == -40.15662 -40*h(28) + 40*h(29) - 164*x1(28) - 279*x2(28) - 344*x3(28) == -39.61135 -40*h(29) + 40*h(30) - 164*x1(29) - 279*x2(29) - 344*x3(29) == -62.77389 -40*h(30) + 40*h(31) - 164*x1(30) - 279*x2(30) - 344*x3(30) == -93.55933 -40*h(31) + 40*h(32) - 164*x1(31) - 279*x2(31) - 344*x3(31) == -290.3023 -40*h(32) + 40*h(33) - 164*x1(32) - 279*x2(32) - 344*x3(32) == -426.5916 -40*h(33) + 40*h(34) - 164*x1(33) - 279*x2(33) - 344*x3(33) == -298.8461 -40*h(34) + 40*h(35) - 164*x1(34) - 279*x2(34) - 344*x3(34) == -147.3086 -40*h(35) + 40*h(36) - 164*x1(35) - 279*x2(35) - 344*x3(35) == -139.8566 -40*h(36) + 40*h(37) - 164*x1(36) - 279*x2(36) - 344*x3(36) == -161.1729 -40*h(37) + 40*h(38) - 164*x1(37) - 279*x2(37) - 344*x3(37) == -139.7414 -40*h(38) + 40*h(39) - 164*x1(38) - 279*x2(38) - 344*x3(38) == -140.855 -40*h(39) + 40*h(40) - 164*x1(39) - 279*x2(39) - 344*x3(39) == -187.5111 -40*h(40) + 40*h(41) - 164*x1(40) - 279*x2(40) - 344*x3(40) == -131.7223 -40*h(41) + 40*h(42) - 164*x1(41) - 279*x2(41) - 344*x3(41) == -166.9372 -40*h(42) + 40*h(43) - 164*x1(42) - 279*x2(42) - 344*x3(42) == -259.0779 -40*h(43) + 40*h(44) - 164*x1(43) - 279*x2(43) - 344*x3(43) == -373.2758 -40*h(44) + 40*h(45) - 164*x1(44) - 279*x2(44) - 344*x3(44) == -254.76 -40*h(45) + 40*h(46) - 164*x1(45) - 279*x2(45) - 344*x3(45) == -104.3436 -40*h(46) + 40*h(47) - 164*x1(46) - 279*x2(46) - 344*x3(46) == -82.48822 -40*h(47) + 40*h(48) - 164*x1(47) - 279*x2(47) - 344*x3(47) == -42.27931 -40*h(48) + 40*h(49) - 164*x1(48) - 279*x2(48) - 344*x3(48) == -35.31565 -40*h(49) + 40*h(50) - 164*x1(49) - 279*x2(49) - 344*x3(49) == -38.46824 -40*h(50) + 40*h(51) - 164*x1(50) - 279*x2(50) - 344*x3(50) == -40.73433 -40*h(51) + 40*h(52) - 164*x1(51) - 279*x2(51) - 344*x3(51) == -16.80125 -40*h(52) + 40*h(53) - 164*x1(52) - 279*x2(52) - 344*x3(52) == -53.98513 -40*h(53) + 40*h(54) - 164*x1(53) - 279*x2(53) - 344*x3(53) == -62.7549 -40*h(54) + 40*h(55) - 164*x1(54) - 279*x2(54) - 344*x3(54) == -93.13059 -40*h(55) + 40*h(56) - 164*x1(55) - 279*x2(55) - 344*x3(55) == -260.9499 -40*h(56) + 40*h(57) - 164*x1(56) - 279*x2(56) - 344*x3(56) == -449.9182 -40*h(57) + 40*h(58) - 164*x1(57) - 279*x2(57) - 344*x3(57) == -332.9872 -40*h(58) + 40*h(59) - 164*x1(58) - 279*x2(58) - 344*x3(58) == -162.0193 -40*h(59) + 40*h(60) - 164*x1(59) - 279*x2(59) - 344*x3(59) == -164.2634 -40*h(60) + 40*h(61) - 164*x1(60) - 279*x2(60) - 344*x3(60) == -131.1906 -40*h(61) + 40*h(62) - 164*x1(61) - 279*x2(61) - 344*x3(61) == -142.5634 -40*h(62) + 40*h(63) - 164*x1(62) - 279*x2(62) - 344*x3(62) == -137.7548 -40*h(63) + 40*h(64) - 164*x1(63) - 279*x2(63) - 344*x3(63) == -165.2979 -40*h(64) + 40*h(65) - 164*x1(64) - 279*x2(64) - 344*x3(64) == -164.9538 -40*h(65) + 40*h(66) - 164*x1(65) - 279*x2(65) - 344*x3(65) == -189.5452 -40*h(66) + 40*h(67) - 164*x1(66) - 279*x2(66) - 344*x3(66) == -287.9646 -40*h(67) + 40*h(68) - 164*x1(67) - 279*x2(67) - 344*x3(67) == -362.3608 -40*h(68) + 40*h(69) - 164*x1(68) - 279*x2(68) - 344*x3(68) == -221.9312 -40*h(69) + 40*h(70) - 164*x1(69) - 279*x2(69) - 344*x3(69) == -102.4647 -40*h(70) + 40*h(71) - 164*x1(70) - 279*x2(70) - 344*x3(70) == -70.87541 -40*h(71) + 40*h(72) - 164*x1(71) - 279*x2(71) - 344*x3(71) == -62.03586 subject to constr2: x1(1) + x2(1) + x3(1) <= 1 x1(2) + x2(2) + x3(2) <= 1 x1(3) + x2(3) + x3(3) <= 1 x1(4) + x2(4) + x3(4) <= 1 x1(5) + x2(5) + x3(5) <= 1 x1(6) + x2(6) + x3(6) <= 1 x1(7) + x2(7) + x3(7) <= 1 x1(8) + x2(8) + x3(8) <= 1 x1(9) + x2(9) + x3(9) <= 1 x1(10) + x2(10) + x3(10) <= 1 x1(11) + x2(11) + x3(11) <= 1 x1(12) + x2(12) + x3(12) <= 1 x1(13) + x2(13) + x3(13) <= 1 x1(14) + x2(14) + x3(14) <= 1 x1(15) + x2(15) + x3(15) <= 1 x1(16) + x2(16) + x3(16) <= 1 x1(17) + x2(17) + x3(17) <= 1 x1(18) + x2(18) + x3(18) <= 1 x1(19) + x2(19) + x3(19) <= 1 x1(20) + x2(20) + x3(20) <= 1 x1(21) + x2(21) + x3(21) <= 1 x1(22) + x2(22) + x3(22) <= 1 x1(23) + x2(23) + x3(23) <= 1 x1(24) + x2(24) + x3(24) <= 1 x1(25) + x2(25) + x3(25) <= 1 x1(26) + x2(26) + x3(26) <= 1 x1(27) + x2(27) + x3(27) <= 1 x1(28) + x2(28) + x3(28) <= 1 x1(29) + x2(29) + x3(29) <= 1 x1(30) + x2(30) + x3(30) <= 1 x1(31) + x2(31) + x3(31) <= 1 x1(32) + x2(32) + x3(32) <= 1 x1(33) + x2(33) + x3(33) <= 1 x1(34) + x2(34) + x3(34) <= 1 x1(35) + x2(35) + x3(35) <= 1 x1(36) + x2(36) + x3(36) <= 1 x1(37) + x2(37) + x3(37) <= 1 x1(38) + x2(38) + x3(38) <= 1 x1(39) + x2(39) + x3(39) <= 1 x1(40) + x2(40) + x3(40) <= 1 x1(41) + x2(41) + x3(41) <= 1 x1(42) + x2(42) + x3(42) <= 1 x1(43) + x2(43) + x3(43) <= 1 x1(44) + x2(44) + x3(44) <= 1 x1(45) + x2(45) + x3(45) <= 1 x1(46) + x2(46) + x3(46) <= 1 x1(47) + x2(47) + x3(47) <= 1 x1(48) + x2(48) + x3(48) <= 1 x1(49) + x2(49) + x3(49) <= 1 x1(50) + x2(50) + x3(50) <= 1 x1(51) + x2(51) + x3(51) <= 1 x1(52) + x2(52) + x3(52) <= 1 x1(53) + x2(53) + x3(53) <= 1 x1(54) + x2(54) + x3(54) <= 1 x1(55) + x2(55) + x3(55) <= 1 x1(56) + x2(56) + x3(56) <= 1 x1(57) + x2(57) + x3(57) <= 1 x1(58) + x2(58) + x3(58) <= 1 x1(59) + x2(59) + x3(59) <= 1 x1(60) + x2(60) + x3(60) <= 1 x1(61) + x2(61) + x3(61) <= 1 x1(62) + x2(62) + x3(62) <= 1 x1(63) + x2(63) + x3(63) <= 1 x1(64) + x2(64) + x3(64) <= 1 x1(65) + x2(65) + x3(65) <= 1 x1(66) + x2(66) + x3(66) <= 1 x1(67) + x2(67) + x3(67) <= 1 x1(68) + x2(68) + x3(68) <= 1 x1(69) + x2(69) + x3(69) <= 1 x1(70) + x2(70) + x3(70) <= 1 x1(71) + x2(71) + x3(71) <= 1 variable bounds: 0 <= h(1) <= 7 0 <= h(2) <= 7 0 <= h(3) <= 7 0 <= h(4) <= 7 0 <= h(5) <= 7 0 <= h(6) <= 7 0 <= h(7) <= 7 0 <= h(8) <= 7 0 <= h(9) <= 7 0 <= h(10) <= 7 0 <= h(11) <= 7 0 <= h(12) <= 7 0 <= h(13) <= 7 0 <= h(14) <= 7 0 <= h(15) <= 7 0 <= h(16) <= 7 0 <= h(17) <= 7 0 <= h(18) <= 7 0 <= h(19) <= 7 0 <= h(20) <= 7 0 <= h(21) <= 7 0 <= h(22) <= 7 0 <= h(23) <= 7 0 <= h(24) <= 7 0 <= h(25) <= 7 0 <= h(26) <= 7 0 <= h(27) <= 7 0 <= h(28) <= 7 0 <= h(29) <= 7 0 <= h(30) <= 7 0 <= h(31) <= 7 0 <= h(32) <= 7 0 <= h(33) <= 7 0 <= h(34) <= 7 0 <= h(35) <= 7 0 <= h(36) <= 7 0 <= h(37) <= 7 0 <= h(38) <= 7 0 <= h(39) <= 7 0 <= h(40) <= 7 0 <= h(41) <= 7 0 <= h(42) <= 7 0 <= h(43) <= 7 0 <= h(44) <= 7 0 <= h(45) <= 7 0 <= h(46) <= 7 0 <= h(47) <= 7 0 <= h(48) <= 7 0 <= h(49) <= 7 0 <= h(50) <= 7 0 <= h(51) <= 7 0 <= h(52) <= 7 0 <= h(53) <= 7 0 <= h(54) <= 7 0 <= h(55) <= 7 0 <= h(56) <= 7 0 <= h(57) <= 7 0 <= h(58) <= 7 0 <= h(59) <= 7 0 <= h(60) <= 7 0 <= h(61) <= 7 0 <= h(62) <= 7 0 <= h(63) <= 7 0 <= h(64) <= 7 0 <= h(65) <= 7 0 <= h(66) <= 7 0 <= h(67) <= 7 0 <= h(68) <= 7 0 <= h(69) <= 7 0 <= h(70) <= 7 0 <= h(71) <= 7 0 <= h(72) <= 7 0 <= x1(1) <= 1 0 <= x1(2) <= 1 0 <= x1(3) <= 1 0 <= x1(4) <= 1 0 <= x1(5) <= 1 0 <= x1(6) <= 1 0 <= x1(7) <= 1 0 <= x1(8) <= 1 0 <= x1(9) <= 1 0 <= x1(10) <= 1 0 <= x1(11) <= 1 0 <= x1(12) <= 1 0 <= x1(13) <= 1 0 <= x1(14) <= 1 0 <= x1(15) <= 1 0 <= x1(16) <= 1 0 <= x1(17) <= 1 0 <= x1(18) <= 1 0 <= x1(19) <= 1 0 <= x1(20) <= 1 0 <= x1(21) <= 1 0 <= x1(22) <= 1 0 <= x1(23) <= 1 0 <= x1(24) <= 1 0 <= x1(25) <= 1 0 <= x1(26) <= 1 0 <= x1(27) <= 1 0 <= x1(28) <= 1 0 <= x1(29) <= 1 0 <= x1(30) <= 1 0 <= x1(31) <= 1 0 <= x1(32) <= 1 0 <= x1(33) <= 1 0 <= x1(34) <= 1 0 <= x1(35) <= 1 0 <= x1(36) <= 1 0 <= x1(37) <= 1 0 <= x1(38) <= 1 0 <= x1(39) <= 1 0 <= x1(40) <= 1 0 <= x1(41) <= 1 0 <= x1(42) <= 1 0 <= x1(43) <= 1 0 <= x1(44) <= 1 0 <= x1(45) <= 1 0 <= x1(46) <= 1 0 <= x1(47) <= 1 0 <= x1(48) <= 1 0 <= x1(49) <= 1 0 <= x1(50) <= 1 0 <= x1(51) <= 1 0 <= x1(52) <= 1 0 <= x1(53) <= 1 0 <= x1(54) <= 1 0 <= x1(55) <= 1 0 <= x1(56) <= 1 0 <= x1(57) <= 1 0 <= x1(58) <= 1 0 <= x1(59) <= 1 0 <= x1(60) <= 1 0 <= x1(61) <= 1 0 <= x1(62) <= 1 0 <= x1(63) <= 1 0 <= x1(64) <= 1 0 <= x1(65) <= 1 0 <= x1(66) <= 1 0 <= x1(67) <= 1 0 <= x1(68) <= 1 0 <= x1(69) <= 1 0 <= x1(70) <= 1 0 <= x1(71) <= 1 0 <= x2(1) <= 1 0 <= x2(2) <= 1 0 <= x2(3) <= 1 0 <= x2(4) <= 1 0 <= x2(5) <= 1 0 <= x2(6) <= 1 0 <= x2(7) <= 1 0 <= x2(8) <= 1 0 <= x2(9) <= 1 0 <= x2(10) <= 1 0 <= x2(11) <= 1 0 <= x2(12) <= 1 0 <= x2(13) <= 1 0 <= x2(14) <= 1 0 <= x2(15) <= 1 0 <= x2(16) <= 1 0 <= x2(17) <= 1 0 <= x2(18) <= 1 0 <= x2(19) <= 1 0 <= x2(20) <= 1 0 <= x2(21) <= 1 0 <= x2(22) <= 1 0 <= x2(23) <= 1 0 <= x2(24) <= 1 0 <= x2(25) <= 1 0 <= x2(26) <= 1 0 <= x2(27) <= 1 0 <= x2(28) <= 1 0 <= x2(29) <= 1 0 <= x2(30) <= 1 0 <= x2(31) <= 1 0 <= x2(32) <= 1 0 <= x2(33) <= 1 0 <= x2(34) <= 1 0 <= x2(35) <= 1 0 <= x2(36) <= 1 0 <= x2(37) <= 1 0 <= x2(38) <= 1 0 <= x2(39) <= 1 0 <= x2(40) <= 1 0 <= x2(41) <= 1 0 <= x2(42) <= 1 0 <= x2(43) <= 1 0 <= x2(44) <= 1 0 <= x2(45) <= 1 0 <= x2(46) <= 1 0 <= x2(47) <= 1 0 <= x2(48) <= 1 0 <= x2(49) <= 1 0 <= x2(50) <= 1 0 <= x2(51) <= 1 0 <= x2(52) <= 1 0 <= x2(53) <= 1 0 <= x2(54) <= 1 0 <= x2(55) <= 1 0 <= x2(56) <= 1 0 <= x2(57) <= 1 0 <= x2(58) <= 1 0 <= x2(59) <= 1 0 <= x2(60) <= 1 0 <= x2(61) <= 1 0 <= x2(62) <= 1 0 <= x2(63) <= 1 0 <= x2(64) <= 1 0 <= x2(65) <= 1 0 <= x2(66) <= 1 0 <= x2(67) <= 1 0 <= x2(68) <= 1 0 <= x2(69) <= 1 0 <= x2(70) <= 1 0 <= x2(71) <= 1 0 <= x3(1) <= 1 0 <= x3(2) <= 1 0 <= x3(3) <= 1 0 <= x3(4) <= 1 0 <= x3(5) <= 1 0 <= x3(6) <= 1 0 <= x3(7) <= 1 0 <= x3(8) <= 1 0 <= x3(9) <= 1 0 <= x3(10) <= 1 0 <= x3(11) <= 1 0 <= x3(12) <= 1 0 <= x3(13) <= 1 0 <= x3(14) <= 1 0 <= x3(15) <= 1 0 <= x3(16) <= 1 0 <= x3(17) <= 1 0 <= x3(18) <= 1 0 <= x3(19) <= 1 0 <= x3(20) <= 1 0 <= x3(21) <= 1 0 <= x3(22) <= 1 0 <= x3(23) <= 1 0 <= x3(24) <= 1 0 <= x3(25) <= 1 0 <= x3(26) <= 1 0 <= x3(27) <= 1 0 <= x3(28) <= 1 0 <= x3(29) <= 1 0 <= x3(30) <= 1 0 <= x3(31) <= 1 0 <= x3(32) <= 1 0 <= x3(33) <= 1 0 <= x3(34) <= 1 0 <= x3(35) <= 1 0 <= x3(36) <= 1 0 <= x3(37) <= 1 0 <= x3(38) <= 1 0 <= x3(39) <= 1 0 <= x3(40) <= 1 0 <= x3(41) <= 1 0 <= x3(42) <= 1 0 <= x3(43) <= 1 0 <= x3(44) <= 1 0 <= x3(45) <= 1 0 <= x3(46) <= 1 0 <= x3(47) <= 1 0 <= x3(48) <= 1 0 <= x3(49) <= 1 0 <= x3(50) <= 1 0 <= x3(51) <= 1 0 <= x3(52) <= 1 0 <= x3(53) <= 1 0 <= x3(54) <= 1 0 <= x3(55) <= 1 0 <= x3(56) <= 1 0 <= x3(57) <= 1 0 <= x3(58) <= 1 0 <= x3(59) <= 1 0 <= x3(60) <= 1 0 <= x3(61) <= 1 0 <= x3(62) <= 1 0 <= x3(63) <= 1 0 <= x3(64) <= 1 0 <= x3(65) <= 1 0 <= x3(66) <= 1 0 <= x3(67) <= 1 0 <= x3(68) <= 1 0 <= x3(69) <= 1 0 <= x3(70) <= 1 0 <= x3(71) <= 1
[sol, fval, exitflag] = solve(problem);
Solving problem using intlinprog. LP: Optimal objective value is 71.667790. Cut Generation: Applied 19 Gomory cuts, 7 implication cuts, 7 flow cover cuts, and 12 mir cuts. Lower bound is 73.000000. Cut Generation: Applied 1 Gomory cut, and 1 implication cut. Lower bound is 73.000000. Branch and Bound: nodes total num int integer relative explored time (s) solution fval gap (%) 517 0.31 1 7.500000e+01 2.631579e+00 2444 0.74 2 7.400000e+01 1.333333e+00 3752 1.01 3 7.300000e+01 1.152231e-13 3752 1.01 3 7.300000e+01 1.152231e-13 Optimal solution found. Intlinprog stopped because the objective value is within a gap tolerance of the optimal value, options.AbsoluteGapTolerance = 0 (the default value). The intcon variables are integer within tolerance, options.IntegerTolerance = 1e-05 (the default value).
figure(1)
plot(time,sol.h)
figure(2)
plot(time(1:end-1),sol.x1+2*sol.x2+3*sol.x3)
function [WaterDemand,T_max] = generateWaterDemand(num_days)
t = 0:(num_days*24)-1; % hr
T_max = t(end);
Demand_mean = [28, 28, 28, 45, 55, 110, 280, 450, 310, 170, 160, 145, 130, ...
150, 165, 155, 170, 265, 360, 240, 120, 83, 45, 28]'; % m^3/hr
Demand = repmat(Demand_mean,1,num_days);
Demand = Demand(:);
% Add noise to demand
a = -25; % m^3/hr
b = 25; % m^3/hr
Demand_noise = a + (b-a).*rand(numel(Demand),1);
WaterDemand = timeseries(Demand + Demand_noise,t);
WaterDemand.Name = "Water Demand";
WaterDemand.TimeInfo.Units = 'hours';
end
Fathima
Fathima am 4 Mär. 2023
I tried to run the code but not getting correct output. since for h=3.5 , I am getting 0 pumps working and at h=3.92 I am geting x1=1 that is one pump is working. which doesnot make sense since 3.5<3.9 and @3.5 no pump is working.
Fathima
Fathima am 4 Mär. 2023
Bearbeitet: Fathima am 4 Mär. 2023
attached excel sheet .. 1st coloumn is time and 2nd coloumn is Qd that is demand
Torsten
Torsten am 4 Mär. 2023
Bearbeitet: Torsten am 4 Mär. 2023
I tried to run the code but not getting correct output. since for h=3.5 , I am getting 0 pumps working and at h=3.92 I am geting x1=1 that is one pump is working. which doesnot make sense since 3.5<3.9 and @3.5 no pump is working.
If at the time when h=3.5 there is a low water demand and when h=3.9 there is a large water demand, pumps won't work at h=3.5 and will work at h=3.9. So working or not working of pumps does not necessarily depend on the liquid level.
I'm almost certain the code above is correct.
Torsten
Torsten am 4 Mär. 2023
Bearbeitet: Torsten am 5 Mär. 2023
% Load data from excel sheet
time= xlsread('mathlab_water_tank_pipe.xlsx', 'Sheet1', 'A1:A184');
Qd=xlsread('mathlab_water_tank_pipe.xlsx', 'Sheet1', 'B1:B184');
plot(time,Qd)
problem = optimproblem;
% Define the constants and parameters of the problem
T = length(time);
A = 40;
Hmax = 7;
H0 = 3.5;
% Define the decision variables
x1 = optimvar('x1', T-1,1, 'LowerBound', 0, 'UpperBound', 1, 'Type', 'integer');
x2 = optimvar('x2', T-1,1, 'LowerBound', 0, 'UpperBound', 1, 'Type', 'integer');
x3 = optimvar('x3', T-1,1, 'LowerBound', 0, 'UpperBound', 1, 'Type', 'integer');
h = optimvar('h', T,1, 'LowerBound', 0, 'UpperBound', Hmax);
% Define the objective function
problem.Objective = sum(x1+2*x2+3*x3);
% Define the linear constraints
constr1 = optimconstr(T-1);
constr2 = optimconstr(T-1);
constr1(1) = h(1) == H0;
for t = 2:T-1
constr1(t) = A*(h(t+1) - h(t)) == 0.1*(( x1(t)*164 + x2(t)*279 + x3(t)*344) - Qd(t));
end
for t = 1:T-1
constr2(t) = x1(t)+x2(t)+x3(t)<=1;
end
problem.Constraints.constr1 = constr1;
problem.Constraints.constr2 = constr2;
show(problem)
OptimizationProblem : Solve for: h, x1, x2, x3 where: x1, x2, x3 integer minimize : x1(1) + x1(2) + x1(3) + x1(4) + x1(5) + x1(6) + x1(7) + x1(8) + x1(9) + x1(10) + x1(11) + x1(12) + x1(13) + x1(14) + x1(15) + x1(16) + x1(17) + x1(18) + x1(19) + x1(20) + x1(21) + x1(22) + x1(23) + x1(24) + x1(25) + x1(26) + x1(27) + x1(28) + x1(29) + x1(30) + x1(31) + x1(32) + x1(33) + x1(34) + x1(35) + x1(36) + x1(37) + x1(38) + x1(39) + x1(40) + x1(41) + x1(42) + x1(43) + x1(44) + x1(45) + x1(46) + x1(47) + x1(48) + x1(49) + x1(50) + x1(51) + x1(52) + x1(53) + x1(54) + x1(55) + x1(56) + x1(57) + x1(58) + x1(59) + x1(60) + x1(61) + x1(62) + x1(63) + x1(64) + x1(65) + x1(66) + x1(67) + x1(68) + x1(69) + x1(70) + x1(71) + x1(72) + x1(73) + x1(74) + x1(75) + x1(76) + x1(77) + x1(78) + x1(79) + x1(80) + x1(81) + x1(82) + x1(83) + x1(84) + x1(85) + x1(86) + x1(87) + x1(88) + x1(89) + x1(90) + x1(91) + x1(92) + x1(93) + x1(94) + x1(95) + x1(96) + x1(97) + x1(98) + x1(99) + x1(100) + x1(101) + x1(102) + x1(103) + x1(104) + x1(105) + x1(106) + x1(107) + x1(108) + x1(109) + x1(110) + x1(111) + x1(112) + x1(113) + x1(114) + x1(115) + x1(116) + x1(117) + x1(118) + x1(119) + x1(120) + x1(121) + x1(122) + x1(123) + x1(124) + x1(125) + x1(126) + x1(127) + x1(128) + x1(129) + x1(130) + x1(131) + x1(132) + x1(133) + x1(134) + x1(135) + x1(136) + x1(137) + x1(138) + x1(139) + x1(140) + x1(141) + x1(142) + x1(143) + x1(144) + x1(145) + x1(146) + x1(147) + x1(148) + x1(149) + x1(150) + x1(151) + x1(152) + x1(153) + x1(154) + x1(155) + x1(156) + x1(157) + x1(158) + x1(159) + x1(160) + x1(161) + x1(162) + x1(163) + x1(164) + x1(165) + x1(166) + x1(167) + x1(168) + x1(169) + x1(170) + x1(171) + x1(172) + x1(173) + x1(174) + x1(175) + x1(176) + x1(177) + x1(178) + x1(179) + x1(180) + x1(181) + x1(182) + x1(183) + 2*x2(1) + 2*x2(2) + 2*x2(3) + 2*x2(4) + 2*x2(5) + 2*x2(6) + 2*x2(7) + 2*x2(8) + 2*x2(9) + 2*x2(10) + 2*x2(11) + 2*x2(12) + 2*x2(13) + 2*x2(14) + 2*x2(15) + 2*x2(16) + 2*x2(17) + 2*x2(18) + 2*x2(19) + 2*x2(20) + 2*x2(21) + 2*x2(22) + 2*x2(23) + 2*x2(24) + 2*x2(25) + 2*x2(26) + 2*x2(27) + 2*x2(28) + 2*x2(29) + 2*x2(30) + 2*x2(31) + 2*x2(32) + 2*x2(33) + 2*x2(34) + 2*x2(35) + 2*x2(36) + 2*x2(37) + 2*x2(38) + 2*x2(39) + 2*x2(40) + 2*x2(41) + 2*x2(42) + 2*x2(43) + 2*x2(44) + 2*x2(45) + 2*x2(46) + 2*x2(47) + 2*x2(48) + 2*x2(49) + 2*x2(50) + 2*x2(51) + 2*x2(52) + 2*x2(53) + 2*x2(54) + 2*x2(55) + 2*x2(56) + 2*x2(57) + 2*x2(58) + 2*x2(59) + 2*x2(60) + 2*x2(61) + 2*x2(62) + 2*x2(63) + 2*x2(64) + 2*x2(65) + 2*x2(66) + 2*x2(67) + 2*x2(68) + 2*x2(69) + 2*x2(70) + 2*x2(71) + 2*x2(72) + 2*x2(73) + 2*x2(74) + 2*x2(75) + 2*x2(76) + 2*x2(77) + 2*x2(78) + 2*x2(79) + 2*x2(80) + 2*x2(81) + 2*x2(82) + 2*x2(83) + 2*x2(84) + 2*x2(85) + 2*x2(86) + 2*x2(87) + 2*x2(88) + 2*x2(89) + 2*x2(90) + 2*x2(91) + 2*x2(92) + 2*x2(93) + 2*x2(94) + 2*x2(95) + 2*x2(96) + 2*x2(97) + 2*x2(98) + 2*x2(99) + 2*x2(100) + 2*x2(101) + 2*x2(102) + 2*x2(103) + 2*x2(104) + 2*x2(105) + 2*x2(106) + 2*x2(107) + 2*x2(108) + 2*x2(109) + 2*x2(110) + 2*x2(111) + 2*x2(112) + 2*x2(113) + 2*x2(114) + 2*x2(115) + 2*x2(116) + 2*x2(117) + 2*x2(118) + 2*x2(119) + 2*x2(120) + 2*x2(121) + 2*x2(122) + 2*x2(123) + 2*x2(124) + 2*x2(125) + 2*x2(126) + 2*x2(127) + 2*x2(128) + 2*x2(129) + 2*x2(130) + 2*x2(131) + 2*x2(132) + 2*x2(133) + 2*x2(134) + 2*x2(135) + 2*x2(136) + 2*x2(137) + 2*x2(138) + 2*x2(139) + 2*x2(140) + 2*x2(141) + 2*x2(142) + 2*x2(143) + 2*x2(144) + 2*x2(145) + 2*x2(146) + 2*x2(147) + 2*x2(148) + 2*x2(149) + 2*x2(150) + 2*x2(151) + 2*x2(152) + 2*x2(153) + 2*x2(154) + 2*x2(155) + 2*x2(156) + 2*x2(157) + 2*x2(158) + 2*x2(159) + 2*x2(160) + 2*x2(161) + 2*x2(162) + 2*x2(163) + 2*x2(164) + 2*x2(165) + 2*x2(166) + 2*x2(167) + 2*x2(168) + 2*x2(169) + 2*x2(170) + 2*x2(171) + 2*x2(172) + 2*x2(173) + 2*x2(174) + 2*x2(175) + 2*x2(176) + 2*x2(177) + 2*x2(178) + 2*x2(179) + 2*x2(180) + 2*x2(181) + 2*x2(182) + 2*x2(183) + 3*x3(1) + 3*x3(2) + 3*x3(3) + 3*x3(4) + 3*x3(5) + 3*x3(6) + 3*x3(7) + 3*x3(8) + 3*x3(9) + 3*x3(10) + 3*x3(11) + 3*x3(12) + 3*x3(13) + 3*x3(14) + 3*x3(15) + 3*x3(16) + 3*x3(17) + 3*x3(18) + 3*x3(19) + 3*x3(20) + 3*x3(21) + 3*x3(22) + 3*x3(23) + 3*x3(24) + 3*x3(25) + 3*x3(26) + 3*x3(27) + 3*x3(28) + 3*x3(29) + 3*x3(30) + 3*x3(31) + 3*x3(32) + 3*x3(33) + 3*x3(34) + 3*x3(35) + 3*x3(36) + 3*x3(37) + 3*x3(38) + 3*x3(39) + 3*x3(40) + 3*x3(41) + 3*x3(42) + 3*x3(43) + 3*x3(44) + 3*x3(45) + 3*x3(46) + 3*x3(47) + 3*x3(48) + 3*x3(49) + 3*x3(50) + 3*x3(51) + 3*x3(52) + 3*x3(53) + 3*x3(54) + 3*x3(55) + 3*x3(56) + 3*x3(57) + 3*x3(58) + 3*x3(59) + 3*x3(60) + 3*x3(61) + 3*x3(62) + 3*x3(63) + 3*x3(64) + 3*x3(65) + 3*x3(66) + 3*x3(67) + 3*x3(68) + 3*x3(69) + 3*x3(70) + 3*x3(71) + 3*x3(72) + 3*x3(73) + 3*x3(74) + 3*x3(75) + 3*x3(76) + 3*x3(77) + 3*x3(78) + 3*x3(79) + 3*x3(80) + 3*x3(81) + 3*x3(82) + 3*x3(83) + 3*x3(84) + 3*x3(85) + 3*x3(86) + 3*x3(87) + 3*x3(88) + 3*x3(89) + 3*x3(90) + 3*x3(91) + 3*x3(92) + 3*x3(93) + 3*x3(94) + 3*x3(95) + 3*x3(96) + 3*x3(97) + 3*x3(98) + 3*x3(99) + 3*x3(100) + 3*x3(101) + 3*x3(102) + 3*x3(103) + 3*x3(104) + 3*x3(105) + 3*x3(106) + 3*x3(107) + 3*x3(108) + 3*x3(109) + 3*x3(110) + 3*x3(111) + 3*x3(112) + 3*x3(113) + 3*x3(114) + 3*x3(115) + 3*x3(116) + 3*x3(117) + 3*x3(118) + 3*x3(119) + 3*x3(120) + 3*x3(121) + 3*x3(122) + 3*x3(123) + 3*x3(124) + 3*x3(125) + 3*x3(126) + 3*x3(127) + 3*x3(128) + 3*x3(129) + 3*x3(130) + 3*x3(131) + 3*x3(132) + 3*x3(133) + 3*x3(134) + 3*x3(135) + 3*x3(136) + 3*x3(137) + 3*x3(138) + 3*x3(139) + 3*x3(140) + 3*x3(141) + 3*x3(142) + 3*x3(143) + 3*x3(144) + 3*x3(145) + 3*x3(146) + 3*x3(147) + 3*x3(148) + 3*x3(149) + 3*x3(150) + 3*x3(151) + 3*x3(152) + 3*x3(153) + 3*x3(154) + 3*x3(155) + 3*x3(156) + 3*x3(157) + 3*x3(158) + 3*x3(159) + 3*x3(160) + 3*x3(161) + 3*x3(162) + 3*x3(163) + 3*x3(164) + 3*x3(165) + 3*x3(166) + 3*x3(167) + 3*x3(168) + 3*x3(169) + 3*x3(170) + 3*x3(171) + 3*x3(172) + 3*x3(173) + 3*x3(174) + 3*x3(175) + 3*x3(176) + 3*x3(177) + 3*x3(178) + 3*x3(179) + 3*x3(180) + 3*x3(181) + 3*x3(182) + 3*x3(183) subject to constr1: h(1) == 3.5 -40*h(2) + 40*h(3) - 16.4*x1(2) - 27.9*x2(2) - 34.4*x3(2) == -3.38902 -40*h(3) + 40*h(4) - 16.4*x1(3) - 27.9*x2(3) - 34.4*x3(3) == -3.25732 -40*h(4) + 40*h(5) - 16.4*x1(4) - 27.9*x2(4) - 34.4*x3(4) == -3.12563 -40*h(5) + 40*h(6) - 16.4*x1(5) - 27.9*x2(5) - 34.4*x3(5) == -2.99393 -40*h(6) + 40*h(7) - 16.4*x1(6) - 27.9*x2(6) - 34.4*x3(6) == -2.86223 -40*h(7) + 40*h(8) - 16.4*x1(7) - 27.9*x2(7) - 34.4*x3(7) == -2.73053 -40*h(8) + 40*h(9) - 16.4*x1(8) - 27.9*x2(8) - 34.4*x3(8) == -2.59884 -40*h(9) + 40*h(10) - 16.4*x1(9) - 27.9*x2(9) - 34.4*x3(9) == -2.46714 -40*h(10) + 40*h(11) - 16.4*x1(10) - 27.9*x2(10) - 34.4*x3(10) == -2.33544 -40*h(11) + 40*h(12) - 16.4*x1(11) - 27.9*x2(11) - 34.4*x3(11) == -2.20374 -40*h(12) + 40*h(13) - 16.4*x1(12) - 27.9*x2(12) - 34.4*x3(12) == -2.34489 -40*h(13) + 40*h(14) - 16.4*x1(13) - 27.9*x2(13) - 34.4*x3(13) == -2.48604 -40*h(14) + 40*h(15) - 16.4*x1(14) - 27.9*x2(14) - 34.4*x3(14) == -2.62719 -40*h(15) + 40*h(16) - 16.4*x1(15) - 27.9*x2(15) - 34.4*x3(15) == -2.76834 -40*h(16) + 40*h(17) - 16.4*x1(16) - 27.9*x2(16) - 34.4*x3(16) == -2.90949 -40*h(17) + 40*h(18) - 16.4*x1(17) - 27.9*x2(17) - 34.4*x3(17) == -3.05064 -40*h(18) + 40*h(19) - 16.4*x1(18) - 27.9*x2(18) - 34.4*x3(18) == -3.19179 -40*h(19) + 40*h(20) - 16.4*x1(19) - 27.9*x2(19) - 34.4*x3(19) == -3.33294 -40*h(20) + 40*h(21) - 16.4*x1(20) - 27.9*x2(20) - 34.4*x3(20) == -3.47409 -40*h(21) + 40*h(22) - 16.4*x1(21) - 27.9*x2(21) - 34.4*x3(21) == -3.61524 -40*h(22) + 40*h(23) - 16.4*x1(22) - 27.9*x2(22) - 34.4*x3(22) == -3.53554 -40*h(23) + 40*h(24) - 16.4*x1(23) - 27.9*x2(23) - 34.4*x3(23) == -3.45584 -40*h(24) + 40*h(25) - 16.4*x1(24) - 27.9*x2(24) - 34.4*x3(24) == -3.37614 -40*h(25) + 40*h(26) - 16.4*x1(25) - 27.9*x2(25) - 34.4*x3(25) == -3.29645 -40*h(26) + 40*h(27) - 16.4*x1(26) - 27.9*x2(26) - 34.4*x3(26) == -3.21675 -40*h(27) + 40*h(28) - 16.4*x1(27) - 27.9*x2(27) - 34.4*x3(27) == -3.13705 -40*h(28) + 40*h(29) - 16.4*x1(28) - 27.9*x2(28) - 34.4*x3(28) == -3.05735 -40*h(29) + 40*h(30) - 16.4*x1(29) - 27.9*x2(29) - 34.4*x3(29) == -2.97765 -40*h(30) + 40*h(31) - 16.4*x1(30) - 27.9*x2(30) - 34.4*x3(30) == -2.89795 -40*h(31) + 40*h(32) - 16.4*x1(31) - 27.9*x2(31) - 34.4*x3(31) == -2.81825 -40*h(32) + 40*h(33) - 16.4*x1(32) - 27.9*x2(32) - 34.4*x3(32) == -3.31773 -40*h(33) + 40*h(34) - 16.4*x1(33) - 27.9*x2(33) - 34.4*x3(33) == -3.81721 -40*h(34) + 40*h(35) - 16.4*x1(34) - 27.9*x2(34) - 34.4*x3(34) == -4.31669 -40*h(35) + 40*h(36) - 16.4*x1(35) - 27.9*x2(35) - 34.4*x3(35) == -4.81617 -40*h(36) + 40*h(37) - 16.4*x1(36) - 27.9*x2(36) - 34.4*x3(36) == -5.31565 -40*h(37) + 40*h(38) - 16.4*x1(37) - 27.9*x2(37) - 34.4*x3(37) == -5.81512 -40*h(38) + 40*h(39) - 16.4*x1(38) - 27.9*x2(38) - 34.4*x3(38) == -6.3146 -40*h(39) + 40*h(40) - 16.4*x1(39) - 27.9*x2(39) - 34.4*x3(39) == -6.81408 -40*h(40) + 40*h(41) - 16.4*x1(40) - 27.9*x2(40) - 34.4*x3(40) == -7.31356 -40*h(41) + 40*h(42) - 16.4*x1(41) - 27.9*x2(41) - 34.4*x3(41) == -7.81304 -40*h(42) + 40*h(43) - 16.4*x1(42) - 27.9*x2(42) - 34.4*x3(42) == -8.05507 -40*h(43) + 40*h(44) - 16.4*x1(43) - 27.9*x2(43) - 34.4*x3(43) == -8.29709 -40*h(44) + 40*h(45) - 16.4*x1(44) - 27.9*x2(44) - 34.4*x3(44) == -8.53912 -40*h(45) + 40*h(46) - 16.4*x1(45) - 27.9*x2(45) - 34.4*x3(45) == -8.78115 -40*h(46) + 40*h(47) - 16.4*x1(46) - 27.9*x2(46) - 34.4*x3(46) == -9.02317 -40*h(47) + 40*h(48) - 16.4*x1(47) - 27.9*x2(47) - 34.4*x3(47) == -9.2652 -40*h(48) + 40*h(49) - 16.4*x1(48) - 27.9*x2(48) - 34.4*x3(48) == -9.50723 -40*h(49) + 40*h(50) - 16.4*x1(49) - 27.9*x2(49) - 34.4*x3(49) == -9.74926 -40*h(50) + 40*h(51) - 16.4*x1(50) - 27.9*x2(50) - 34.4*x3(50) == -9.99128 -40*h(51) + 40*h(52) - 16.4*x1(51) - 27.9*x2(51) - 34.4*x3(51) == -10.2333 -40*h(52) + 40*h(53) - 16.4*x1(52) - 27.9*x2(52) - 34.4*x3(52) == -12.2559 -40*h(53) + 40*h(54) - 16.4*x1(53) - 27.9*x2(53) - 34.4*x3(53) == -14.2784 -40*h(54) + 40*h(55) - 16.4*x1(54) - 27.9*x2(54) - 34.4*x3(54) == -16.3009 -40*h(55) + 40*h(56) - 16.4*x1(55) - 27.9*x2(55) - 34.4*x3(55) == -18.3235 -40*h(56) + 40*h(57) - 16.4*x1(56) - 27.9*x2(56) - 34.4*x3(56) == -20.346 -40*h(57) + 40*h(58) - 16.4*x1(57) - 27.9*x2(57) - 34.4*x3(57) == -22.3686 -40*h(58) + 40*h(59) - 16.4*x1(58) - 27.9*x2(58) - 34.4*x3(58) == -24.3911 -40*h(59) + 40*h(60) - 16.4*x1(59) - 27.9*x2(59) - 34.4*x3(59) == -26.4137 -40*h(60) + 40*h(61) - 16.4*x1(60) - 27.9*x2(60) - 34.4*x3(60) == -28.4362 -40*h(61) + 40*h(62) - 16.4*x1(61) - 27.9*x2(61) - 34.4*x3(61) == -30.4588 -40*h(62) + 40*h(63) - 16.4*x1(62) - 27.9*x2(62) - 34.4*x3(62) == -31.7804 -40*h(63) + 40*h(64) - 16.4*x1(63) - 27.9*x2(63) - 34.4*x3(63) == -33.1021 -40*h(64) + 40*h(65) - 16.4*x1(64) - 27.9*x2(64) - 34.4*x3(64) == -34.4237 -40*h(65) + 40*h(66) - 16.4*x1(65) - 27.9*x2(65) - 34.4*x3(65) == -35.7454 -40*h(66) + 40*h(67) - 16.4*x1(66) - 27.9*x2(66) - 34.4*x3(66) == -37.067 -40*h(67) + 40*h(68) - 16.4*x1(67) - 27.9*x2(67) - 34.4*x3(67) == -38.3887 -40*h(68) + 40*h(69) - 16.4*x1(68) - 27.9*x2(68) - 34.4*x3(68) == -39.7103 -40*h(69) + 40*h(70) - 16.4*x1(69) - 27.9*x2(69) - 34.4*x3(69) == -41.032 -40*h(70) + 40*h(71) - 16.4*x1(70) - 27.9*x2(70) - 34.4*x3(70) == -42.3536 -40*h(71) + 40*h(72) - 16.4*x1(71) - 27.9*x2(71) - 34.4*x3(71) == -43.6753 -40*h(72) + 40*h(73) - 16.4*x1(72) - 27.9*x2(72) - 34.4*x3(72) == -42.4506 -40*h(73) + 40*h(74) - 16.4*x1(73) - 27.9*x2(73) - 34.4*x3(73) == -41.2259 -40*h(74) + 40*h(75) - 16.4*x1(74) - 27.9*x2(74) - 34.4*x3(74) == -40.0012 -40*h(75) + 40*h(76) - 16.4*x1(75) - 27.9*x2(75) - 34.4*x3(75) == -38.7766 -40*h(76) + 40*h(77) - 16.4*x1(76) - 27.9*x2(76) - 34.4*x3(76) == -37.5519 -40*h(77) + 40*h(78) - 16.4*x1(77) - 27.9*x2(77) - 34.4*x3(77) == -36.3272 -40*h(78) + 40*h(79) - 16.4*x1(78) - 27.9*x2(78) - 34.4*x3(78) == -35.1025 -40*h(79) + 40*h(80) - 16.4*x1(79) - 27.9*x2(79) - 34.4*x3(79) == -33.8778 -40*h(80) + 40*h(81) - 16.4*x1(80) - 27.9*x2(80) - 34.4*x3(80) == -32.6532 -40*h(81) + 40*h(82) - 16.4*x1(81) - 27.9*x2(81) - 34.4*x3(81) == -31.4285 -40*h(82) + 40*h(83) - 16.4*x1(82) - 27.9*x2(82) - 34.4*x3(82) == -29.939 -40*h(83) + 40*h(84) - 16.4*x1(83) - 27.9*x2(83) - 34.4*x3(83) == -28.4495 -40*h(84) + 40*h(85) - 16.4*x1(84) - 27.9*x2(84) - 34.4*x3(84) == -26.96 -40*h(85) + 40*h(86) - 16.4*x1(85) - 27.9*x2(85) - 34.4*x3(85) == -25.4705 -40*h(86) + 40*h(87) - 16.4*x1(86) - 27.9*x2(86) - 34.4*x3(86) == -23.981 -40*h(87) + 40*h(88) - 16.4*x1(87) - 27.9*x2(87) - 34.4*x3(87) == -22.4915 -40*h(88) + 40*h(89) - 16.4*x1(88) - 27.9*x2(88) - 34.4*x3(88) == -21.002 -40*h(89) + 40*h(90) - 16.4*x1(89) - 27.9*x2(89) - 34.4*x3(89) == -19.5125 -40*h(90) + 40*h(91) - 16.4*x1(90) - 27.9*x2(90) - 34.4*x3(90) == -18.023 -40*h(91) + 40*h(92) - 16.4*x1(91) - 27.9*x2(91) - 34.4*x3(91) == -16.5335 -40*h(92) + 40*h(93) - 16.4*x1(92) - 27.9*x2(92) - 34.4*x3(92) == -16.2982 -40*h(93) + 40*h(94) - 16.4*x1(93) - 27.9*x2(93) - 34.4*x3(93) == -16.063 -40*h(94) + 40*h(95) - 16.4*x1(94) - 27.9*x2(94) - 34.4*x3(94) == -15.8278 -40*h(95) + 40*h(96) - 16.4*x1(95) - 27.9*x2(95) - 34.4*x3(95) == -15.5925 -40*h(96) + 40*h(97) - 16.4*x1(96) - 27.9*x2(96) - 34.4*x3(96) == -15.3573 -40*h(97) + 40*h(98) - 16.4*x1(97) - 27.9*x2(97) - 34.4*x3(97) == -15.1221 -40*h(98) + 40*h(99) - 16.4*x1(98) - 27.9*x2(98) - 34.4*x3(98) == -14.8869 -40*h(99) + 40*h(100) - 16.4*x1(99) - 27.9*x2(99) - 34.4*x3(99) == -14.6516 -40*h(100) + 40*h(101) - 16.4*x1(100) - 27.9*x2(100) - 34.4*x3(100) == -14.4164 -40*h(101) + 40*h(102) - 16.4*x1(101) - 27.9*x2(101) - 34.4*x3(101) == -14.1812 -40*h(102) + 40*h(103) - 16.4*x1(102) - 27.9*x2(102) - 34.4*x3(102) == -14.2351 -40*h(103) + 40*h(104) - 16.4*x1(103) - 27.9*x2(103) - 34.4*x3(103) == -14.2891 -40*h(104) + 40*h(105) - 16.4*x1(104) - 27.9*x2(104) - 34.4*x3(104) == -14.343 -40*h(105) + 40*h(106) - 16.4*x1(105) - 27.9*x2(105) - 34.4*x3(105) == -14.397 -40*h(106) + 40*h(107) - 16.4*x1(106) - 27.9*x2(106) - 34.4*x3(106) == -14.4509 -40*h(107) + 40*h(108) - 16.4*x1(107) - 27.9*x2(107) - 34.4*x3(107) == -14.5049 -40*h(108) + 40*h(109) - 16.4*x1(108) - 27.9*x2(108) - 34.4*x3(108) == -14.5588 -40*h(109) + 40*h(110) - 16.4*x1(109) - 27.9*x2(109) - 34.4*x3(109) == -14.6128 -40*h(110) + 40*h(111) - 16.4*x1(110) - 27.9*x2(110) - 34.4*x3(110) == -14.6667 -40*h(111) + 40*h(112) - 16.4*x1(111) - 27.9*x2(111) - 34.4*x3(111) == -14.7207 -40*h(112) + 40*h(113) - 16.4*x1(112) - 27.9*x2(112) - 34.4*x3(112) == -14.5577 -40*h(113) + 40*h(114) - 16.4*x1(113) - 27.9*x2(113) - 34.4*x3(113) == -14.3947 -40*h(114) + 40*h(115) - 16.4*x1(114) - 27.9*x2(114) - 34.4*x3(114) == -14.2317 -40*h(115) + 40*h(116) - 16.4*x1(115) - 27.9*x2(115) - 34.4*x3(115) == -14.0688 -40*h(116) + 40*h(117) - 16.4*x1(116) - 27.9*x2(116) - 34.4*x3(116) == -13.9058 -40*h(117) + 40*h(118) - 16.4*x1(117) - 27.9*x2(117) - 34.4*x3(117) == -13.7428 -40*h(118) + 40*h(119) - 16.4*x1(118) - 27.9*x2(118) - 34.4*x3(118) == -13.5798 -40*h(119) + 40*h(120) - 16.4*x1(119) - 27.9*x2(119) - 34.4*x3(119) == -13.4168 -40*h(120) + 40*h(121) - 16.4*x1(120) - 27.9*x2(120) - 34.4*x3(120) == -13.2539 -40*h(121) + 40*h(122) - 16.4*x1(121) - 27.9*x2(121) - 34.4*x3(121) == -13.0909 -40*h(122) + 40*h(123) - 16.4*x1(122) - 27.9*x2(122) - 34.4*x3(122) == -13.4152 -40*h(123) + 40*h(124) - 16.4*x1(123) - 27.9*x2(123) - 34.4*x3(123) == -13.7396 -40*h(124) + 40*h(125) - 16.4*x1(124) - 27.9*x2(124) - 34.4*x3(124) == -14.0639 -40*h(125) + 40*h(126) - 16.4*x1(125) - 27.9*x2(125) - 34.4*x3(125) == -14.3882 -40*h(126) + 40*h(127) - 16.4*x1(126) - 27.9*x2(126) - 34.4*x3(126) == -14.7126 -40*h(127) + 40*h(128) - 16.4*x1(127) - 27.9*x2(127) - 34.4*x3(127) == -15.0369 -40*h(128) + 40*h(129) - 16.4*x1(128) - 27.9*x2(128) - 34.4*x3(128) == -15.3613 -40*h(129) + 40*h(130) - 16.4*x1(129) - 27.9*x2(129) - 34.4*x3(129) == -15.6856 -40*h(130) + 40*h(131) - 16.4*x1(130) - 27.9*x2(130) - 34.4*x3(130) == -16.0099 -40*h(131) + 40*h(132) - 16.4*x1(131) - 27.9*x2(131) - 34.4*x3(131) == -16.3343 -40*h(132) + 40*h(133) - 16.4*x1(132) - 27.9*x2(132) - 34.4*x3(132) == -16.5678 -40*h(133) + 40*h(134) - 16.4*x1(133) - 27.9*x2(133) - 34.4*x3(133) == -16.8013 -40*h(134) + 40*h(135) - 16.4*x1(134) - 27.9*x2(134) - 34.4*x3(134) == -17.0348 -40*h(135) + 40*h(136) - 16.4*x1(135) - 27.9*x2(135) - 34.4*x3(135) == -17.2683 -40*h(136) + 40*h(137) - 16.4*x1(136) - 27.9*x2(136) - 34.4*x3(136) == -17.5018 -40*h(137) + 40*h(138) - 16.4*x1(137) - 27.9*x2(137) - 34.4*x3(137) == -17.7353 -40*h(138) + 40*h(139) - 16.4*x1(138) - 27.9*x2(138) - 34.4*x3(138) == -17.9688 -40*h(139) + 40*h(140) - 16.4*x1(139) - 27.9*x2(139) - 34.4*x3(139) == -18.2023 -40*h(140) + 40*h(141) - 16.4*x1(140) - 27.9*x2(140) - 34.4*x3(140) == -18.4358 -40*h(141) + 40*h(142) - 16.4*x1(141) - 27.9*x2(141) - 34.4*x3(141) == -18.6693 -40*h(142) + 40*h(143) - 16.4*x1(142) - 27.9*x2(142) - 34.4*x3(142) == -18.1472 -40*h(143) + 40*h(144) - 16.4*x1(143) - 27.9*x2(143) - 34.4*x3(143) == -17.6251 -40*h(144) + 40*h(145) - 16.4*x1(144) - 27.9*x2(144) - 34.4*x3(144) == -17.103 -40*h(145) + 40*h(146) - 16.4*x1(145) - 27.9*x2(145) - 34.4*x3(145) == -16.581 -40*h(146) + 40*h(147) - 16.4*x1(146) - 27.9*x2(146) - 34.4*x3(146) == -16.0589 -40*h(147) + 40*h(148) - 16.4*x1(147) - 27.9*x2(147) - 34.4*x3(147) == -15.5368 -40*h(148) + 40*h(149) - 16.4*x1(148) - 27.9*x2(148) - 34.4*x3(148) == -15.0147 -40*h(149) + 40*h(150) - 16.4*x1(149) - 27.9*x2(149) - 34.4*x3(149) == -14.4927 -40*h(150) + 40*h(151) - 16.4*x1(150) - 27.9*x2(150) - 34.4*x3(150) == -13.9706 -40*h(151) + 40*h(152) - 16.4*x1(151) - 27.9*x2(151) - 34.4*x3(151) == -13.4485 -40*h(152) + 40*h(153) - 16.4*x1(152) - 27.9*x2(152) - 34.4*x3(152) == -13.6516 -40*h(153) + 40*h(154) - 16.4*x1(153) - 27.9*x2(153) - 34.4*x3(153) == -13.8546 -40*h(154) + 40*h(155) - 16.4*x1(154) - 27.9*x2(154) - 34.4*x3(154) == -14.0576 -40*h(155) + 40*h(156) - 16.4*x1(155) - 27.9*x2(155) - 34.4*x3(155) == -14.2607 -40*h(156) + 40*h(157) - 16.4*x1(156) - 27.9*x2(156) - 34.4*x3(156) == -14.4637 -40*h(157) + 40*h(158) - 16.4*x1(157) - 27.9*x2(157) - 34.4*x3(157) == -14.6667 -40*h(158) + 40*h(159) - 16.4*x1(158) - 27.9*x2(158) - 34.4*x3(158) == -14.8698 -40*h(159) + 40*h(160) - 16.4*x1(159) - 27.9*x2(159) - 34.4*x3(159) == -15.0728 -40*h(160) + 40*h(161) - 16.4*x1(160) - 27.9*x2(160) - 34.4*x3(160) == -15.2758 -40*h(161) + 40*h(162) - 16.4*x1(161) - 27.9*x2(161) - 34.4*x3(161) == -15.4789 -40*h(162) + 40*h(163) - 16.4*x1(162) - 27.9*x2(162) - 34.4*x3(162) == -16.8281 -40*h(163) + 40*h(164) - 16.4*x1(163) - 27.9*x2(163) - 34.4*x3(163) == -18.1773 -40*h(164) + 40*h(165) - 16.4*x1(164) - 27.9*x2(164) - 34.4*x3(164) == -19.5265 -40*h(165) + 40*h(166) - 16.4*x1(165) - 27.9*x2(165) - 34.4*x3(165) == -20.8757 -40*h(166) + 40*h(167) - 16.4*x1(166) - 27.9*x2(166) - 34.4*x3(166) == -22.2249 -40*h(167) + 40*h(168) - 16.4*x1(167) - 27.9*x2(167) - 34.4*x3(167) == -23.5741 -40*h(168) + 40*h(169) - 16.4*x1(168) - 27.9*x2(168) - 34.4*x3(168) == -24.9233 -40*h(169) + 40*h(170) - 16.4*x1(169) - 27.9*x2(169) - 34.4*x3(169) == -26.2725 -40*h(170) + 40*h(171) - 16.4*x1(170) - 27.9*x2(170) - 34.4*x3(170) == -27.6218 -40*h(171) + 40*h(172) - 16.4*x1(171) - 27.9*x2(171) - 34.4*x3(171) == -28.971 -40*h(172) + 40*h(173) - 16.4*x1(172) - 27.9*x2(172) - 34.4*x3(172) == -29.5415 -40*h(173) + 40*h(174) - 16.4*x1(173) - 27.9*x2(173) - 34.4*x3(173) == -30.112 -40*h(174) + 40*h(175) - 16.4*x1(174) - 27.9*x2(174) - 34.4*x3(174) == -30.6824 -40*h(175) + 40*h(176) - 16.4*x1(175) - 27.9*x2(175) - 34.4*x3(175) == -31.2529 -40*h(176) + 40*h(177) - 16.4*x1(176) - 27.9*x2(176) - 34.4*x3(176) == -31.8234 -40*h(177) + 40*h(178) - 16.4*x1(177) - 27.9*x2(177) - 34.4*x3(177) == -32.3939 -40*h(178) + 40*h(179) - 16.4*x1(178) - 27.9*x2(178) - 34.4*x3(178) == -32.9644 -40*h(179) + 40*h(180) - 16.4*x1(179) - 27.9*x2(179) - 34.4*x3(179) == -33.5349 -40*h(180) + 40*h(181) - 16.4*x1(180) - 27.9*x2(180) - 34.4*x3(180) == -34.1054 -40*h(181) + 40*h(182) - 16.4*x1(181) - 27.9*x2(181) - 34.4*x3(181) == -34.6759 -40*h(182) + 40*h(183) - 16.4*x1(182) - 27.9*x2(182) - 34.4*x3(182) == -33.4778 -40*h(183) + 40*h(184) - 16.4*x1(183) - 27.9*x2(183) - 34.4*x3(183) == -32.2797 subject to constr2: x1(1) + x2(1) + x3(1) <= 1 x1(2) + x2(2) + x3(2) <= 1 x1(3) + x2(3) + x3(3) <= 1 x1(4) + x2(4) + x3(4) <= 1 x1(5) + x2(5) + x3(5) <= 1 x1(6) + x2(6) + x3(6) <= 1 x1(7) + x2(7) + x3(7) <= 1 x1(8) + x2(8) + x3(8) <= 1 x1(9) + x2(9) + x3(9) <= 1 x1(10) + x2(10) + x3(10) <= 1 x1(11) + x2(11) + x3(11) <= 1 x1(12) + x2(12) + x3(12) <= 1 x1(13) + x2(13) + x3(13) <= 1 x1(14) + x2(14) + x3(14) <= 1 x1(15) + x2(15) + x3(15) <= 1 x1(16) + x2(16) + x3(16) <= 1 x1(17) + x2(17) + x3(17) <= 1 x1(18) + x2(18) + x3(18) <= 1 x1(19) + x2(19) + x3(19) <= 1 x1(20) + x2(20) + x3(20) <= 1 x1(21) + x2(21) + x3(21) <= 1 x1(22) + x2(22) + x3(22) <= 1 x1(23) + x2(23) + x3(23) <= 1 x1(24) + x2(24) + x3(24) <= 1 x1(25) + x2(25) + x3(25) <= 1 x1(26) + x2(26) + x3(26) <= 1 x1(27) + x2(27) + x3(27) <= 1 x1(28) + x2(28) + x3(28) <= 1 x1(29) + x2(29) + x3(29) <= 1 x1(30) + x2(30) + x3(30) <= 1 x1(31) + x2(31) + x3(31) <= 1 x1(32) + x2(32) + x3(32) <= 1 x1(33) + x2(33) + x3(33) <= 1 x1(34) + x2(34) + x3(34) <= 1 x1(35) + x2(35) + x3(35) <= 1 x1(36) + x2(36) + x3(36) <= 1 x1(37) + x2(37) + x3(37) <= 1 x1(38) + x2(38) + x3(38) <= 1 x1(39) + x2(39) + x3(39) <= 1 x1(40) + x2(40) + x3(40) <= 1 x1(41) + x2(41) + x3(41) <= 1 x1(42) + x2(42) + x3(42) <= 1 x1(43) + x2(43) + x3(43) <= 1 x1(44) + x2(44) + x3(44) <= 1 x1(45) + x2(45) + x3(45) <= 1 x1(46) + x2(46) + x3(46) <= 1 x1(47) + x2(47) + x3(47) <= 1 x1(48) + x2(48) + x3(48) <= 1 x1(49) + x2(49) + x3(49) <= 1 x1(50) + x2(50) + x3(50) <= 1 x1(51) + x2(51) + x3(51) <= 1 x1(52) + x2(52) + x3(52) <= 1 x1(53) + x2(53) + x3(53) <= 1 x1(54) + x2(54) + x3(54) <= 1 x1(55) + x2(55) + x3(55) <= 1 x1(56) + x2(56) + x3(56) <= 1 x1(57) + x2(57) + x3(57) <= 1 x1(58) + x2(58) + x3(58) <= 1 x1(59) + x2(59) + x3(59) <= 1 x1(60) + x2(60) + x3(60) <= 1 x1(61) + x2(61) + x3(61) <= 1 x1(62) + x2(62) + x3(62) <= 1 x1(63) + x2(63) + x3(63) <= 1 x1(64) + x2(64) + x3(64) <= 1 x1(65) + x2(65) + x3(65) <= 1 x1(66) + x2(66) + x3(66) <= 1 x1(67) + x2(67) + x3(67) <= 1 x1(68) + x2(68) + x3(68) <= 1 x1(69) + x2(69) + x3(69) <= 1 x1(70) + x2(70) + x3(70) <= 1 x1(71) + x2(71) + x3(71) <= 1 x1(72) + x2(72) + x3(72) <= 1 x1(73) + x2(73) + x3(73) <= 1 x1(74) + x2(74) + x3(74) <= 1 x1(75) + x2(75) + x3(75) <= 1 x1(76) + x2(76) + x3(76) <= 1 x1(77) + x2(77) + x3(77) <= 1 x1(78) + x2(78) + x3(78) <= 1 x1(79) + x2(79) + x3(79) <= 1 x1(80) + x2(80) + x3(80) <= 1 x1(81) + x2(81) + x3(81) <= 1 x1(82) + x2(82) + x3(82) <= 1 x1(83) + x2(83) + x3(83) <= 1 x1(84) + x2(84) + x3(84) <= 1 x1(85) + x2(85) + x3(85) <= 1 x1(86) + x2(86) + x3(86) <= 1 x1(87) + x2(87) + x3(87) <= 1 x1(88) + x2(88) + x3(88) <= 1 x1(89) + x2(89) + x3(89) <= 1 x1(90) + x2(90) + x3(90) <= 1 x1(91) + x2(91) + x3(91) <= 1 x1(92) + x2(92) + x3(92) <= 1 x1(93) + x2(93) + x3(93) <= 1 x1(94) + x2(94) + x3(94) <= 1 x1(95) + x2(95) + x3(95) <= 1 x1(96) + x2(96) + x3(96) <= 1 x1(97) + x2(97) + x3(97) <= 1 x1(98) + x2(98) + x3(98) <= 1 x1(99) + x2(99) + x3(99) <= 1 x1(100) + x2(100) + x3(100) <= 1 x1(101) + x2(101) + x3(101) <= 1 x1(102) + x2(102) + x3(102) <= 1 x1(103) + x2(103) + x3(103) <= 1 x1(104) + x2(104) + x3(104) <= 1 x1(105) + x2(105) + x3(105) <= 1 x1(106) + x2(106) + x3(106) <= 1 x1(107) + x2(107) + x3(107) <= 1 x1(108) + x2(108) + x3(108) <= 1 x1(109) + x2(109) + x3(109) <= 1 x1(110) + x2(110) + x3(110) <= 1 x1(111) + x2(111) + x3(111) <= 1 x1(112) + x2(112) + x3(112) <= 1 x1(113) + x2(113) + x3(113) <= 1 x1(114) + x2(114) + x3(114) <= 1 x1(115) + x2(115) + x3(115) <= 1 x1(116) + x2(116) + x3(116) <= 1 x1(117) + x2(117) + x3(117) <= 1 x1(118) + x2(118) + x3(118) <= 1 x1(119) + x2(119) + x3(119) <= 1 x1(120) + x2(120) + x3(120) <= 1 x1(121) + x2(121) + x3(121) <= 1 x1(122) + x2(122) + x3(122) <= 1 x1(123) + x2(123) + x3(123) <= 1 x1(124) + x2(124) + x3(124) <= 1 x1(125) + x2(125) + x3(125) <= 1 x1(126) + x2(126) + x3(126) <= 1 x1(127) + x2(127) + x3(127) <= 1 x1(128) + x2(128) + x3(128) <= 1 x1(129) + x2(129) + x3(129) <= 1 x1(130) + x2(130) + x3(130) <= 1 x1(131) + x2(131) + x3(131) <= 1 x1(132) + x2(132) + x3(132) <= 1 x1(133) + x2(133) + x3(133) <= 1 x1(134) + x2(134) + x3(134) <= 1 x1(135) + x2(135) + x3(135) <= 1 x1(136) + x2(136) + x3(136) <= 1 x1(137) + x2(137) + x3(137) <= 1 x1(138) + x2(138) + x3(138) <= 1 x1(139) + x2(139) + x3(139) <= 1 x1(140) + x2(140) + x3(140) <= 1 x1(141) + x2(141) + x3(141) <= 1 x1(142) + x2(142) + x3(142) <= 1 x1(143) + x2(143) + x3(143) <= 1 x1(144) + x2(144) + x3(144) <= 1 x1(145) + x2(145) + x3(145) <= 1 x1(146) + x2(146) + x3(146) <= 1 x1(147) + x2(147) + x3(147) <= 1 x1(148) + x2(148) + x3(148) <= 1 x1(149) + x2(149) + x3(149) <= 1 x1(150) + x2(150) + x3(150) <= 1 x1(151) + x2(151) + x3(151) <= 1 x1(152) + x2(152) + x3(152) <= 1 x1(153) + x2(153) + x3(153) <= 1 x1(154) + x2(154) + x3(154) <= 1 x1(155) + x2(155) + x3(155) <= 1 x1(156) + x2(156) + x3(156) <= 1 x1(157) + x2(157) + x3(157) <= 1 x1(158) + x2(158) + x3(158) <= 1 x1(159) + x2(159) + x3(159) <= 1 x1(160) + x2(160) + x3(160) <= 1 x1(161) + x2(161) + x3(161) <= 1 x1(162) + x2(162) + x3(162) <= 1 x1(163) + x2(163) + x3(163) <= 1 x1(164) + x2(164) + x3(164) <= 1 x1(165) + x2(165) + x3(165) <= 1 x1(166) + x2(166) + x3(166) <= 1 x1(167) + x2(167) + x3(167) <= 1 x1(168) + x2(168) + x3(168) <= 1 x1(169) + x2(169) + x3(169) <= 1 x1(170) + x2(170) + x3(170) <= 1 x1(171) + x2(171) + x3(171) <= 1 x1(172) + x2(172) + x3(172) <= 1 x1(173) + x2(173) + x3(173) <= 1 x1(174) + x2(174) + x3(174) <= 1 x1(175) + x2(175) + x3(175) <= 1 x1(176) + x2(176) + x3(176) <= 1 x1(177) + x2(177) + x3(177) <= 1 x1(178) + x2(178) + x3(178) <= 1 x1(179) + x2(179) + x3(179) <= 1 x1(180) + x2(180) + x3(180) <= 1 x1(181) + x2(181) + x3(181) <= 1 x1(182) + x2(182) + x3(182) <= 1 x1(183) + x2(183) + x3(183) <= 1 variable bounds: 0 <= h(1) <= 7 0 <= h(2) <= 7 0 <= h(3) <= 7 0 <= h(4) <= 7 0 <= h(5) <= 7 0 <= h(6) <= 7 0 <= h(7) <= 7 0 <= h(8) <= 7 0 <= h(9) <= 7 0 <= h(10) <= 7 0 <= h(11) <= 7 0 <= h(12) <= 7 0 <= h(13) <= 7 0 <= h(14) <= 7 0 <= h(15) <= 7 0 <= h(16) <= 7 0 <= h(17) <= 7 0 <= h(18) <= 7 0 <= h(19) <= 7 0 <= h(20) <= 7 0 <= h(21) <= 7 0 <= h(22) <= 7 0 <= h(23) <= 7 0 <= h(24) <= 7 0 <= h(25) <= 7 0 <= h(26) <= 7 0 <= h(27) <= 7 0 <= h(28) <= 7 0 <= h(29) <= 7 0 <= h(30) <= 7 0 <= h(31) <= 7 0 <= h(32) <= 7 0 <= h(33) <= 7 0 <= h(34) <= 7 0 <= h(35) <= 7 0 <= h(36) <= 7 0 <= h(37) <= 7 0 <= h(38) <= 7 0 <= h(39) <= 7 0 <= h(40) <= 7 0 <= h(41) <= 7 0 <= h(42) <= 7 0 <= h(43) <= 7 0 <= h(44) <= 7 0 <= h(45) <= 7 0 <= h(46) <= 7 0 <= h(47) <= 7 0 <= h(48) <= 7 0 <= h(49) <= 7 0 <= h(50) <= 7 0 <= h(51) <= 7 0 <= h(52) <= 7 0 <= h(53) <= 7 0 <= h(54) <= 7 0 <= h(55) <= 7 0 <= h(56) <= 7 0 <= h(57) <= 7 0 <= h(58) <= 7 0 <= h(59) <= 7 0 <= h(60) <= 7 0 <= h(61) <= 7 0 <= h(62) <= 7 0 <= h(63) <= 7 0 <= h(64) <= 7 0 <= h(65) <= 7 0 <= h(66) <= 7 0 <= h(67) <= 7 0 <= h(68) <= 7 0 <= h(69) <= 7 0 <= h(70) <= 7 0 <= h(71) <= 7 0 <= h(72) <= 7 0 <= h(73) <= 7 0 <= h(74) <= 7 0 <= h(75) <= 7 0 <= h(76) <= 7 0 <= h(77) <= 7 0 <= h(78) <= 7 0 <= h(79) <= 7 0 <= h(80) <= 7 0 <= h(81) <= 7 0 <= h(82) <= 7 0 <= h(83) <= 7 0 <= h(84) <= 7 0 <= h(85) <= 7 0 <= h(86) <= 7 0 <= h(87) <= 7 0 <= h(88) <= 7 0 <= h(89) <= 7 0 <= h(90) <= 7 0 <= h(91) <= 7 0 <= h(92) <= 7 0 <= h(93) <= 7 0 <= h(94) <= 7 0 <= h(95) <= 7 0 <= h(96) <= 7 0 <= h(97) <= 7 0 <= h(98) <= 7 0 <= h(99) <= 7 0 <= h(100) <= 7 0 <= h(101) <= 7 0 <= h(102) <= 7 0 <= h(103) <= 7 0 <= h(104) <= 7 0 <= h(105) <= 7 0 <= h(106) <= 7 0 <= h(107) <= 7 0 <= h(108) <= 7 0 <= h(109) <= 7 0 <= h(110) <= 7 0 <= h(111) <= 7 0 <= h(112) <= 7 0 <= h(113) <= 7 0 <= h(114) <= 7 0 <= h(115) <= 7 0 <= h(116) <= 7 0 <= h(117) <= 7 0 <= h(118) <= 7 0 <= h(119) <= 7 0 <= h(120) <= 7 0 <= h(121) <= 7 0 <= h(122) <= 7 0 <= h(123) <= 7 0 <= h(124) <= 7 0 <= h(125) <= 7 0 <= h(126) <= 7 0 <= h(127) <= 7 0 <= h(128) <= 7 0 <= h(129) <= 7 0 <= h(130) <= 7 0 <= h(131) <= 7 0 <= h(132) <= 7 0 <= h(133) <= 7 0 <= h(134) <= 7 0 <= h(135) <= 7 0 <= h(136) <= 7 0 <= h(137) <= 7 0 <= h(138) <= 7 0 <= h(139) <= 7 0 <= h(140) <= 7 0 <= h(141) <= 7 0 <= h(142) <= 7 0 <= h(143) <= 7 0 <= h(144) <= 7 0 <= h(145) <= 7 0 <= h(146) <= 7 0 <= h(147) <= 7 0 <= h(148) <= 7 0 <= h(149) <= 7 0 <= h(150) <= 7 0 <= h(151) <= 7 0 <= h(152) <= 7 0 <= h(153) <= 7 0 <= h(154) <= 7 0 <= h(155) <= 7 0 <= h(156) <= 7 0 <= h(157) <= 7 0 <= h(158) <= 7 0 <= h(159) <= 7 0 <= h(160) <= 7 0 <= h(161) <= 7 0 <= h(162) <= 7 0 <= h(163) <= 7 0 <= h(164) <= 7 0 <= h(165) <= 7 0 <= h(166) <= 7 0 <= h(167) <= 7 0 <= h(168) <= 7 0 <= h(169) <= 7 0 <= h(170) <= 7 0 <= h(171) <= 7 0 <= h(172) <= 7 0 <= h(173) <= 7 0 <= h(174) <= 7 0 <= h(175) <= 7 0 <= h(176) <= 7 0 <= h(177) <= 7 0 <= h(178) <= 7 0 <= h(179) <= 7 0 <= h(180) <= 7 0 <= h(181) <= 7 0 <= h(182) <= 7 0 <= h(183) <= 7 0 <= h(184) <= 7 0 <= x1(1) <= 1 0 <= x1(2) <= 1 0 <= x1(3) <= 1 0 <= x1(4) <= 1 0 <= x1(5) <= 1 0 <= x1(6) <= 1 0 <= x1(7) <= 1 0 <= x1(8) <= 1 0 <= x1(9) <= 1 0 <= x1(10) <= 1 0 <= x1(11) <= 1 0 <= x1(12) <= 1 0 <= x1(13) <= 1 0 <= x1(14) <= 1 0 <= x1(15) <= 1 0 <= x1(16) <= 1 0 <= x1(17) <= 1 0 <= x1(18) <= 1 0 <= x1(19) <= 1 0 <= x1(20) <= 1 0 <= x1(21) <= 1 0 <= x1(22) <= 1 0 <= x1(23) <= 1 0 <= x1(24) <= 1 0 <= x1(25) <= 1 0 <= x1(26) <= 1 0 <= x1(27) <= 1 0 <= x1(28) <= 1 0 <= x1(29) <= 1 0 <= x1(30) <= 1 0 <= x1(31) <= 1 0 <= x1(32) <= 1 0 <= x1(33) <= 1 0 <= x1(34) <= 1 0 <= x1(35) <= 1 0 <= x1(36) <= 1 0 <= x1(37) <= 1 0 <= x1(38) <= 1 0 <= x1(39) <= 1 0 <= x1(40) <= 1 0 <= x1(41) <= 1 0 <= x1(42) <= 1 0 <= x1(43) <= 1 0 <= x1(44) <= 1 0 <= x1(45) <= 1 0 <= x1(46) <= 1 0 <= x1(47) <= 1 0 <= x1(48) <= 1 0 <= x1(49) <= 1 0 <= x1(50) <= 1 0 <= x1(51) <= 1 0 <= x1(52) <= 1 0 <= x1(53) <= 1 0 <= x1(54) <= 1 0 <= x1(55) <= 1 0 <= x1(56) <= 1 0 <= x1(57) <= 1 0 <= x1(58) <= 1 0 <= x1(59) <= 1 0 <= x1(60) <= 1 0 <= x1(61) <= 1 0 <= x1(62) <= 1 0 <= x1(63) <= 1 0 <= x1(64) <= 1 0 <= x1(65) <= 1 0 <= x1(66) <= 1 0 <= x1(67) <= 1 0 <= x1(68) <= 1 0 <= x1(69) <= 1 0 <= x1(70) <= 1 0 <= x1(71) <= 1 0 <= x1(72) <= 1 0 <= x1(73) <= 1 0 <= x1(74) <= 1 0 <= x1(75) <= 1 0 <= x1(76) <= 1 0 <= x1(77) <= 1 0 <= x1(78) <= 1 0 <= x1(79) <= 1 0 <= x1(80) <= 1 0 <= x1(81) <= 1 0 <= x1(82) <= 1 0 <= x1(83) <= 1 0 <= x1(84) <= 1 0 <= x1(85) <= 1 0 <= x1(86) <= 1 0 <= x1(87) <= 1 0 <= x1(88) <= 1 0 <= x1(89) <= 1 0 <= x1(90) <= 1 0 <= x1(91) <= 1 0 <= x1(92) <= 1 0 <= x1(93) <= 1 0 <= x1(94) <= 1 0 <= x1(95) <= 1 0 <= x1(96) <= 1 0 <= x1(97) <= 1 0 <= x1(98) <= 1 0 <= x1(99) <= 1 0 <= x1(100) <= 1 0 <= x1(101) <= 1 0 <= x1(102) <= 1 0 <= x1(103) <= 1 0 <= x1(104) <= 1 0 <= x1(105) <= 1 0 <= x1(106) <= 1 0 <= x1(107) <= 1 0 <= x1(108) <= 1 0 <= x1(109) <= 1 0 <= x1(110) <= 1 0 <= x1(111) <= 1 0 <= x1(112) <= 1 0 <= x1(113) <= 1 0 <= x1(114) <= 1 0 <= x1(115) <= 1 0 <= x1(116) <= 1 0 <= x1(117) <= 1 0 <= x1(118) <= 1 0 <= x1(119) <= 1 0 <= x1(120) <= 1 0 <= x1(121) <= 1 0 <= x1(122) <= 1 0 <= x1(123) <= 1 0 <= x1(124) <= 1 0 <= x1(125) <= 1 0 <= x1(126) <= 1 0 <= x1(127) <= 1 0 <= x1(128) <= 1 0 <= x1(129) <= 1 0 <= x1(130) <= 1 0 <= x1(131) <= 1 0 <= x1(132) <= 1 0 <= x1(133) <= 1 0 <= x1(134) <= 1 0 <= x1(135) <= 1 0 <= x1(136) <= 1 0 <= x1(137) <= 1 0 <= x1(138) <= 1 0 <= x1(139) <= 1 0 <= x1(140) <= 1 0 <= x1(141) <= 1 0 <= x1(142) <= 1 0 <= x1(143) <= 1 0 <= x1(144) <= 1 0 <= x1(145) <= 1 0 <= x1(146) <= 1 0 <= x1(147) <= 1 0 <= x1(148) <= 1 0 <= x1(149) <= 1 0 <= x1(150) <= 1 0 <= x1(151) <= 1 0 <= x1(152) <= 1 0 <= x1(153) <= 1 0 <= x1(154) <= 1 0 <= x1(155) <= 1 0 <= x1(156) <= 1 0 <= x1(157) <= 1 0 <= x1(158) <= 1 0 <= x1(159) <= 1 0 <= x1(160) <= 1 0 <= x1(161) <= 1 0 <= x1(162) <= 1 0 <= x1(163) <= 1 0 <= x1(164) <= 1 0 <= x1(165) <= 1 0 <= x1(166) <= 1 0 <= x1(167) <= 1 0 <= x1(168) <= 1 0 <= x1(169) <= 1 0 <= x1(170) <= 1 0 <= x1(171) <= 1 0 <= x1(172) <= 1 0 <= x1(173) <= 1 0 <= x1(174) <= 1 0 <= x1(175) <= 1 0 <= x1(176) <= 1 0 <= x1(177) <= 1 0 <= x1(178) <= 1 0 <= x1(179) <= 1 0 <= x1(180) <= 1 0 <= x1(181) <= 1 0 <= x1(182) <= 1 0 <= x1(183) <= 1 0 <= x2(1) <= 1 0 <= x2(2) <= 1 0 <= x2(3) <= 1 0 <= x2(4) <= 1 0 <= x2(5) <= 1 0 <= x2(6) <= 1 0 <= x2(7) <= 1 0 <= x2(8) <= 1 0 <= x2(9) <= 1 0 <= x2(10) <= 1 0 <= x2(11) <= 1 0 <= x2(12) <= 1 0 <= x2(13) <= 1 0 <= x2(14) <= 1 0 <= x2(15) <= 1 0 <= x2(16) <= 1 0 <= x2(17) <= 1 0 <= x2(18) <= 1 0 <= x2(19) <= 1 0 <= x2(20) <= 1 0 <= x2(21) <= 1 0 <= x2(22) <= 1 0 <= x2(23) <= 1 0 <= x2(24) <= 1 0 <= x2(25) <= 1 0 <= x2(26) <= 1 0 <= x2(27) <= 1 0 <= x2(28) <= 1 0 <= x2(29) <= 1 0 <= x2(30) <= 1 0 <= x2(31) <= 1 0 <= x2(32) <= 1 0 <= x2(33) <= 1 0 <= x2(34) <= 1 0 <= x2(35) <= 1 0 <= x2(36) <= 1 0 <= x2(37) <= 1 0 <= x2(38) <= 1 0 <= x2(39) <= 1 0 <= x2(40) <= 1 0 <= x2(41) <= 1 0 <= x2(42) <= 1 0 <= x2(43) <= 1 0 <= x2(44) <= 1 0 <= x2(45) <= 1 0 <= x2(46) <= 1 0 <= x2(47) <= 1 0 <= x2(48) <= 1 0 <= x2(49) <= 1 0 <= x2(50) <= 1 0 <= x2(51) <= 1 0 <= x2(52) <= 1 0 <= x2(53) <= 1 0 <= x2(54) <= 1 0 <= x2(55) <= 1 0 <= x2(56) <= 1 0 <= x2(57) <= 1 0 <= x2(58) <= 1 0 <= x2(59) <= 1 0 <= x2(60) <= 1 0 <= x2(61) <= 1 0 <= x2(62) <= 1 0 <= x2(63) <= 1 0 <= x2(64) <= 1 0 <= x2(65) <= 1 0 <= x2(66) <= 1 0 <= x2(67) <= 1 0 <= x2(68) <= 1 0 <= x2(69) <= 1 0 <= x2(70) <= 1 0 <= x2(71) <= 1 0 <= x2(72) <= 1 0 <= x2(73) <= 1 0 <= x2(74) <= 1 0 <= x2(75) <= 1 0 <= x2(76) <= 1 0 <= x2(77) <= 1 0 <= x2(78) <= 1 0 <= x2(79) <= 1 0 <= x2(80) <= 1 0 <= x2(81) <= 1 0 <= x2(82) <= 1 0 <= x2(83) <= 1 0 <= x2(84) <= 1 0 <= x2(85) <= 1 0 <= x2(86) <= 1 0 <= x2(87) <= 1 0 <= x2(88) <= 1 0 <= x2(89) <= 1 0 <= x2(90) <= 1 0 <= x2(91) <= 1 0 <= x2(92) <= 1 0 <= x2(93) <= 1 0 <= x2(94) <= 1 0 <= x2(95) <= 1 0 <= x2(96) <= 1 0 <= x2(97) <= 1 0 <= x2(98) <= 1 0 <= x2(99) <= 1 0 <= x2(100) <= 1 0 <= x2(101) <= 1 0 <= x2(102) <= 1 0 <= x2(103) <= 1 0 <= x2(104) <= 1 0 <= x2(105) <= 1 0 <= x2(106) <= 1 0 <= x2(107) <= 1 0 <= x2(108) <= 1 0 <= x2(109) <= 1 0 <= x2(110) <= 1 0 <= x2(111) <= 1 0 <= x2(112) <= 1 0 <= x2(113) <= 1 0 <= x2(114) <= 1 0 <= x2(115) <= 1 0 <= x2(116) <= 1 0 <= x2(117) <= 1 0 <= x2(118) <= 1 0 <= x2(119) <= 1 0 <= x2(120) <= 1 0 <= x2(121) <= 1 0 <= x2(122) <= 1 0 <= x2(123) <= 1 0 <= x2(124) <= 1 0 <= x2(125) <= 1 0 <= x2(126) <= 1 0 <= x2(127) <= 1 0 <= x2(128) <= 1 0 <= x2(129) <= 1 0 <= x2(130) <= 1 0 <= x2(131) <= 1 0 <= x2(132) <= 1 0 <= x2(133) <= 1 0 <= x2(134) <= 1 0 <= x2(135) <= 1 0 <= x2(136) <= 1 0 <= x2(137) <= 1 0 <= x2(138) <= 1 0 <= x2(139) <= 1 0 <= x2(140) <= 1 0 <= x2(141) <= 1 0 <= x2(142) <= 1 0 <= x2(143) <= 1 0 <= x2(144) <= 1 0 <= x2(145) <= 1 0 <= x2(146) <= 1 0 <= x2(147) <= 1 0 <= x2(148) <= 1 0 <= x2(149) <= 1 0 <= x2(150) <= 1 0 <= x2(151) <= 1 0 <= x2(152) <= 1 0 <= x2(153) <= 1 0 <= x2(154) <= 1 0 <= x2(155) <= 1 0 <= x2(156) <= 1 0 <= x2(157) <= 1 0 <= x2(158) <= 1 0 <= x2(159) <= 1 0 <= x2(160) <= 1 0 <= x2(161) <= 1 0 <= x2(162) <= 1 0 <= x2(163) <= 1 0 <= x2(164) <= 1 0 <= x2(165) <= 1 0 <= x2(166) <= 1 0 <= x2(167) <= 1 0 <= x2(168) <= 1 0 <= x2(169) <= 1 0 <= x2(170) <= 1 0 <= x2(171) <= 1 0 <= x2(172) <= 1 0 <= x2(173) <= 1 0 <= x2(174) <= 1 0 <= x2(175) <= 1 0 <= x2(176) <= 1 0 <= x2(177) <= 1 0 <= x2(178) <= 1 0 <= x2(179) <= 1 0 <= x2(180) <= 1 0 <= x2(181) <= 1 0 <= x2(182) <= 1 0 <= x2(183) <= 1 0 <= x3(1) <= 1 0 <= x3(2) <= 1 0 <= x3(3) <= 1 0 <= x3(4) <= 1 0 <= x3(5) <= 1 0 <= x3(6) <= 1 0 <= x3(7) <= 1 0 <= x3(8) <= 1 0 <= x3(9) <= 1 0 <= x3(10) <= 1 0 <= x3(11) <= 1 0 <= x3(12) <= 1 0 <= x3(13) <= 1 0 <= x3(14) <= 1 0 <= x3(15) <= 1 0 <= x3(16) <= 1 0 <= x3(17) <= 1 0 <= x3(18) <= 1 0 <= x3(19) <= 1 0 <= x3(20) <= 1 0 <= x3(21) <= 1 0 <= x3(22) <= 1 0 <= x3(23) <= 1 0 <= x3(24) <= 1 0 <= x3(25) <= 1 0 <= x3(26) <= 1 0 <= x3(27) <= 1 0 <= x3(28) <= 1 0 <= x3(29) <= 1 0 <= x3(30) <= 1 0 <= x3(31) <= 1 0 <= x3(32) <= 1 0 <= x3(33) <= 1 0 <= x3(34) <= 1 0 <= x3(35) <= 1 0 <= x3(36) <= 1 0 <= x3(37) <= 1 0 <= x3(38) <= 1 0 <= x3(39) <= 1 0 <= x3(40) <= 1 0 <= x3(41) <= 1 0 <= x3(42) <= 1 0 <= x3(43) <= 1 0 <= x3(44) <= 1 0 <= x3(45) <= 1 0 <= x3(46) <= 1 0 <= x3(47) <= 1 0 <= x3(48) <= 1 0 <= x3(49) <= 1 0 <= x3(50) <= 1 0 <= x3(51) <= 1 0 <= x3(52) <= 1 0 <= x3(53) <= 1 0 <= x3(54) <= 1 0 <= x3(55) <= 1 0 <= x3(56) <= 1 0 <= x3(57) <= 1 0 <= x3(58) <= 1 0 <= x3(59) <= 1 0 <= x3(60) <= 1 0 <= x3(61) <= 1 0 <= x3(62) <= 1 0 <= x3(63) <= 1 0 <= x3(64) <= 1 0 <= x3(65) <= 1 0 <= x3(66) <= 1 0 <= x3(67) <= 1 0 <= x3(68) <= 1 0 <= x3(69) <= 1 0 <= x3(70) <= 1 0 <= x3(71) <= 1 0 <= x3(72) <= 1 0 <= x3(73) <= 1 0 <= x3(74) <= 1 0 <= x3(75) <= 1 0 <= x3(76) <= 1 0 <= x3(77) <= 1 0 <= x3(78) <= 1 0 <= x3(79) <= 1 0 <= x3(80) <= 1 0 <= x3(81) <= 1 0 <= x3(82) <= 1 0 <= x3(83) <= 1 0 <= x3(84) <= 1 0 <= x3(85) <= 1 0 <= x3(86) <= 1 0 <= x3(87) <= 1 0 <= x3(88) <= 1 0 <= x3(89) <= 1 0 <= x3(90) <= 1 0 <= x3(91) <= 1 0 <= x3(92) <= 1 0 <= x3(93) <= 1 0 <= x3(94) <= 1 0 <= x3(95) <= 1 0 <= x3(96) <= 1 0 <= x3(97) <= 1 0 <= x3(98) <= 1 0 <= x3(99) <= 1 0 <= x3(100) <= 1 0 <= x3(101) <= 1 0 <= x3(102) <= 1 0 <= x3(103) <= 1 0 <= x3(104) <= 1 0 <= x3(105) <= 1 0 <= x3(106) <= 1 0 <= x3(107) <= 1 0 <= x3(108) <= 1 0 <= x3(109) <= 1 0 <= x3(110) <= 1 0 <= x3(111) <= 1 0 <= x3(112) <= 1 0 <= x3(113) <= 1 0 <= x3(114) <= 1 0 <= x3(115) <= 1 0 <= x3(116) <= 1 0 <= x3(117) <= 1 0 <= x3(118) <= 1 0 <= x3(119) <= 1 0 <= x3(120) <= 1 0 <= x3(121) <= 1 0 <= x3(122) <= 1 0 <= x3(123) <= 1 0 <= x3(124) <= 1 0 <= x3(125) <= 1 0 <= x3(126) <= 1 0 <= x3(127) <= 1 0 <= x3(128) <= 1 0 <= x3(129) <= 1 0 <= x3(130) <= 1 0 <= x3(131) <= 1 0 <= x3(132) <= 1 0 <= x3(133) <= 1 0 <= x3(134) <= 1 0 <= x3(135) <= 1 0 <= x3(136) <= 1 0 <= x3(137) <= 1 0 <= x3(138) <= 1 0 <= x3(139) <= 1 0 <= x3(140) <= 1 0 <= x3(141) <= 1 0 <= x3(142) <= 1 0 <= x3(143) <= 1 0 <= x3(144) <= 1 0 <= x3(145) <= 1 0 <= x3(146) <= 1 0 <= x3(147) <= 1 0 <= x3(148) <= 1 0 <= x3(149) <= 1 0 <= x3(150) <= 1 0 <= x3(151) <= 1 0 <= x3(152) <= 1 0 <= x3(153) <= 1 0 <= x3(154) <= 1 0 <= x3(155) <= 1 0 <= x3(156) <= 1 0 <= x3(157) <= 1 0 <= x3(158) <= 1 0 <= x3(159) <= 1 0 <= x3(160) <= 1 0 <= x3(161) <= 1 0 <= x3(162) <= 1 0 <= x3(163) <= 1 0 <= x3(164) <= 1 0 <= x3(165) <= 1 0 <= x3(166) <= 1 0 <= x3(167) <= 1 0 <= x3(168) <= 1 0 <= x3(169) <= 1 0 <= x3(170) <= 1 0 <= x3(171) <= 1 0 <= x3(172) <= 1 0 <= x3(173) <= 1 0 <= x3(174) <= 1 0 <= x3(175) <= 1 0 <= x3(176) <= 1 0 <= x3(177) <= 1 0 <= x3(178) <= 1 0 <= x3(179) <= 1 0 <= x3(180) <= 1 0 <= x3(181) <= 1 0 <= x3(182) <= 1 0 <= x3(183) <= 1
[sol, fval, exitflag] = solve(problem);
Solving problem using intlinprog. LP: Optimal objective value is 183.779238. Cut Generation: Applied 8 Gomory cuts, and 3 flow cover cuts. Lower bound is 184.000000. Cut Generation: Applied 5 Gomory cuts. Lower bound is 184.000000. Branch and Bound: nodes total num int integer relative explored time (s) solution fval gap (%) 402 0.40 1 1.840000e+02 1.536309e-14 402 0.40 1 1.840000e+02 1.536309e-14 Optimal solution found. Intlinprog stopped because the objective value is within a gap tolerance of the optimal value, options.AbsoluteGapTolerance = 0 (the default value). The intcon variables are integer within tolerance, options.IntegerTolerance = 1e-05 (the default value).
figure(1)
plot(time,sol.h)
figure(2)
plot(time(1:end-1),sol.x1+2*sol.x2+3*sol.x3)
Fathima
Fathima am 4 Mär. 2023
No feasible solution found is ur output... But in mathwork they are getting solution..
Fathima
Fathima am 4 Mär. 2023
Why can't we get answer by optimization? While they have done using Reinforcement Learning and have got output.
Fathima
Fathima am 4 Mär. 2023
As you said height and number of pumps working doesn't depend eachother. Thats the reason I wanted to give constrain where it actually depends.. but you have told that time that intlinprog will automatically do it.. remember? May be this will work if we add that constraint also .. because only that is missing in this optimization model from Reinforcement model.. I am not sure but we can try...
Fathima
Fathima am 4 Mär. 2023
Bearbeitet: Fathima am 4 Mär. 2023
@Torsten In mathwork model , they have added function in simulink which is
function a = fcn(h)
break1 = 4.5;
break2 = 3.5;
a = 0;
if h<6.8 && h>=break1
a = 1;
elseif h<break1 && h>=break2
a = 2;
elseif h<break2
a = 3;
end
here a is number of pump
this is the constraint which connects hight and number of pumps. but problem I faced is how to write this as constraint in matlab.
Torsten
Torsten am 4 Mär. 2023
Bearbeitet: Torsten am 4 Mär. 2023
No feasible solution found is ur output... But in mathwork they are getting solution..
I got a solution to the optimization for a time horizon of 3 days when I used the function "generateWaterDemand" which generates the demand for the pump model from mathworks (see above).
In mathwork model , they have added function in simulink which is
function a = fcn(h)
break1 = 4.5;
break2 = 3.5;
a = 0;
if h<6.8 && h>=break1
a = 1;
elseif h<break1 && h>=break2
a = 2;
elseif h<break2
a = 3;
end
here a is number of pump
As I already wrote, this constraint does not make sense if you use "intlinprog" to optimize the usage of the pumps.
It already prescribes the solution of the optimization problem:
x1(t) = 1, x2(t) = 0, x3(t) = 0 if h < 3.5
x1(t) = 0, x2(t) = 1, x3(t) = 0 if 3.5 <= h < 4.5
x1(t) = 0, x2(t) = 0, x3(t) = 1 if h >= 4.5
Do you understand what I mean ?
If "intlinprog" tells you that there is no solution, then the water demand Qd cannot be satisfied with the supplied pumping power for at least one time instant t if the restriction 0 <= h <= hmax should hold.
Give me a "solution" from Reinforcement Learning for the demand curve you prescribe in your Excel sheet and I'm sure one of the constraints will fail for at least one time t.
As far as I understand the Mathworks example, the aim is - where possible - avoid violating constraints and at the same time activating the pumps efficiently. But this does not exclude possible failures. Optimization is more stringent: if the inputs are such that there is no strategy to avoid failure, the optimizer will return that there is no feasible solution.
Torsten
Torsten am 4 Mär. 2023
The code now also works for your Excel sheet. Seems you changed the time increment from 1 hour to 1/10 hour. This has to be reflected in the "deltat" used.
Fathima
Fathima am 5 Mär. 2023
Bearbeitet: Fathima am 5 Mär. 2023
As you have mentioned It already prescribes the solution of the optimization problem
x1(t) = 1, x2(t) = 0, x3(t) = 0 if h < 3.5
x1(t) = 0, x2(t) = 1, x3(t) = 0 if 3.5 <= h < 4.5
x1(t) = 0, x2(t) = 0, x3(t) = 1 if h >= 4.5
Are u getting the output h and number of pumps which satisfy this condition?
like if h<3.5 are u getting x1=0?
Optimization is more stringent: if the inputs are such that there is no strategy to avoid failure.
okey so since we are getting output for 3 days so optimization is done. and as you have mentioned the above contraint will be automatically considered by intlinprog , then we need to get output accourdingly . but I am getting output where the above mentioned constraint is not satisfied.
Torsten
Torsten am 5 Mär. 2023
Bearbeitet: Torsten am 5 Mär. 2023
Why should "intlinprog" use the strategy to switch on three pumps if h < 3.5, use 2 pumps of 3.5 < = h < 4.5 and use one pump if h >= 4.5 ? The values 3.5 and 4.5 are absolutely empirical and not optimal.
"Intlinprog" is given the water demands over the time period it optimizes because you use the demands in your constraints. That's why "Intlinprog" can find a much better strategy than the one above.
But usually, the demands are uncertain and not exactly known in advance. That's what the Deep Learning Tool is for. It develops a strategy based on data in the past (learning phase) and uses this strategy to take present decisions (now without knowing what exactly the future will bring). Thus both methods try to optimize the usage of the pumps, but the circumstances under which they optimize, namely exact or uncertain knowledge about the future demands, make the mathematical methods used and the results completely different.
If the future demands are known, "intlinprog" will always give the "best" solution. If the future demands are uncertain, you will have to refer to neural networks, Deep Learning or related methods.
Fathima
Fathima am 15 Mär. 2023
@Torsten Thankyou sir . You are truely a good teacher :) ..

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Linear Programming and Mixed-Integer Linear Programming finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 27 Feb. 2023

Kommentiert:

am 15 Mär. 2023

Community Treasure Hunt

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

Start Hunting!

Translated by