Commit a3b849d8 authored by Vladislav Kiselev's avatar Vladislav Kiselev

constraints updated

parent 3bed9686
......@@ -46,44 +46,19 @@ constraint forall (i in 1..n_operations, j in 1..n_intervals ) (op_fin [i,
array [1..n_operations] of var int : operations_duration;
array [1..n_operations] of var bool : is_continuous_operation;
% TODO
%constraint forall (i in 1..n_operations) (
% if (is_continuous_operation[i]) then (
% forall (j in 1..n_intervals) (
% let {var int : len = operations_duration[i]} in
% if (j + len > n_intervals + 1) then
% op_start[i, j] == 0
% else (
% (op_start[i, j] == 1) -> (
% (forall (k in 1..(len - 1))
% (op_status[i, j + k] == 1)
% ) /\
% (op_status[i, j + len] == 0)
% )
% )
% endif
% )
% ) else true
% endif
%);
constraint forall (i in 1..n_operations) (
if (is_continuous_operation[i]) then (
let {var int : len = operations_duration[i]} in
(forall (j in 1..(n_intervals - len + 1)) (
(op_start[i, j] == 1) -> (
(forall (k in 1..(len - 1))
(op_status[i, j + k] == 1)
) /\
(op_status[i, j + len] == 0)
)
)) /\
(forall (j in (n_intervals - len + 2)..(n_intervals + 1))
(op_start[i, j] == 0)
constraint forall (i in 1..n_operations where is_continuous_operation[i]) (
let {var int : len = operations_duration[i]} in
(forall (j in 1..(n_intervals - len + 1)) (
(op_start[i, j] == 1) -> (
(forall (k in 1..(len - 1))
(op_status[i, j + k] == 1)
) /\
(op_status[i, j + len] == 0)
)
) else true
endif
)) /\
(forall (j in (n_intervals - len + 2)..(n_intervals + 1))
(op_start[i, j] == 0)
)
);
% Наличие всех ресурсов на месте во время начала операции перемещения.
......@@ -104,8 +79,6 @@ array [1..n_conflicting_op] of 1..n_operations : confl_op_2;
constraint forall (t in 0..(n_intervals + 1), i in 1..n_conflicting_op) (
(op_status[confl_op_1[i], t] -> not op_status[confl_op_2[i], t])
/\
(op_status[confl_op_2[i], t] -> not op_status[confl_op_1[i], t])
);
% Окна непогоды.
......@@ -114,11 +87,11 @@ array [1..n_bad_weather_windows] of 1..n_operations : bw_op;
array [1..n_bad_weather_windows] of 0..(n_intervals + 1) : bw_start;
array [1..n_bad_weather_windows] of 0..(n_intervals + 1) : bw_fin; % Включительно.
constraint forall (i in 1..n_bad_weather_windows) (
forall (t in bw_start[i]..bw_fin[i]) (op_status[bw_op[i], t] == 0)
constraint forall (i in 1..n_bad_weather_windows, t in bw_start[i]..bw_fin[i]) (
op_status[bw_op[i], t] == 0
);
% Грузоообработка.
% Грузообработка.
int : n_cargo_types;
int : n_obj_with_storage;
array [1..n_obj_with_storage, 0..(n_intervals + 1), 1..n_cargo_types] of var int : storage_used_volume; % Первые n_moving_obj соответствуют наполненности соответствующих движущихся объектов.
......@@ -135,11 +108,10 @@ constraint forall (storage in 1..n_obj_with_storage, t in 0..(n_intervals + 1))
array [1..n_obj_with_storage, 1..n_cargo_types] of int : initial_storage_vol;
array [1..n_obj_with_storage, 1..n_cargo_types] of int : final_storage_vol;
constraint forall (storage in 1..n_obj_with_storage, cargo in 1..n_cargo_types) (
(storage_used_volume[storage, 0, cargo] == initial_storage_vol[storage, cargo])
(storage_used_volume[storage, 0, cargo] = initial_storage_vol[storage, cargo])
/\
(if final_storage_vol[storage, cargo] >= 0 then
(storage_used_volume[storage, (n_intervals + 1), cargo] == final_storage_vol[storage, cargo])
else true
endif)
);
......@@ -164,9 +136,10 @@ constraint forall (storage in 1..n_obj_with_storage, cargo in 1..n_cargo_types,
% Критерий оптимизации
array [0..(n_intervals + 1)] of var bool : is_not_terminated;
constraint (is_not_terminated[0] == 0 /\ is_not_terminated[n_intervals + 1] == 0);
constraint forall (t in 1..n_intervals) (
is_not_terminated[t] == (
(not (forall (op in 1..n_operations) (op_status[op, t] == 0)))
(exists (op in 1..n_operations) (op_status[op, t] == 1))
\/
is_not_terminated[t + 1]
)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment