Commit 4746f729 authored by Vladislav Kiselev's avatar Vladislav Kiselev

Ещё оптимизация.

parent 7765658a
......@@ -429,6 +429,22 @@ array [0..n_operations] of 0..n_locations : operations_destination; % Локац
)
);
array [1..n_operations, 1..n_intervals] of var bool : is_cargo_op_not_exceeds_storage_limits;
constraint forall (op in 1..n_operations, t in 1..n_intervals) (
is_cargo_op_not_exceeds_storage_limits[op, t] =
((not is_moving_operation[op]) -> (
let {1..n_obj_with_storage : m_stor = operations_main_stor[op];
1..n_obj_with_storage : s_stor = operations_secondary_stor[op];
1..n_cargo_types : cargo = operations_cargo_t[op];
int : delta = loading_op_direction[op];
} in
(storage_used_volume[m_stor, t, cargo] + delta >= 0) /\
((sum (c in 1..n_cargo_types) (storage_used_volume[m_stor, t, c])) + delta <= max_storage_vol[m_stor]) /\
(storage_used_volume[s_stor, t, cargo] - delta >= 0) /\
((sum (c in 1..n_cargo_types) (storage_used_volume[s_stor, t, c])) - delta <= max_storage_vol[s_stor])
))
);
% Определение is_op_possible.
constraint forall (op in 1..n_operations, t in 1..n_intervals) (
is_op_possible[op, t] = (
......@@ -447,18 +463,8 @@ array [0..n_operations] of 0..n_locations : operations_destination; % Локац
current_moored_obj[operations_destination[op], t] = 0)
) /\ % Если это операция пришвартовки, то в этот интервал
% причал должен быть свободным.
((not is_moving_operation[op]) -> (
let {1..n_obj_with_storage : m_stor = operations_main_stor[op];
1..n_obj_with_storage : s_stor = operations_secondary_stor[op];
1..n_cargo_types : cargo = operations_cargo_t[op];
int : delta = loading_op_direction[op];
} in
(storage_used_volume[m_stor, t, cargo] + delta >= 0) /\
((sum (c in 1..n_cargo_types) (storage_used_volume[m_stor, t, c])) + delta <= max_storage_vol[m_stor]) /\
(storage_used_volume[s_stor, t, cargo] - delta >= 0) /\
((sum (c in 1..n_cargo_types) (storage_used_volume[s_stor, t, c])) - delta <= max_storage_vol[s_stor])
)) /\ % Если это операция грузообработки, то она не выведет
% объём берегового хранилища и хранилища судна за
(is_cargo_op_not_exceeds_storage_limits[op, t]) % Если это операция грузообработки, то она не выведет
/\ % объём берегового хранилища и хранилища судна за
% границы дозволенного (если исполнится при минимальной
% интенсивности 1).
(((not is_moving_operation[op]) /\ (main_obj_start_loc[op] mod 2 = 1)) ->
......@@ -480,6 +486,16 @@ array [0..n_operations] of 0..n_locations : operations_destination; % Локац
(op_start[op, t] /\ (not is_fixed[op, t])) -> not is_op_possible[op, t - 1]
);
% Оптимизация - есть две соседние операции погрузки - первая операция должна быть максимально загруженной.
constraint forall (op in 1..n_operations, t in 2..n_intervals) (
((cargo_op_intensity[op, t - 1] != 0) /\ (cargo_op_intensity[op, t] != 0)) -> (
(cargo_op_intensity[op, t - 1] = loading_op_abs_delta[op]) \/ % Операция достигла предела интенсивности.
(not is_cargo_op_not_exceeds_storage_limits[op, t - 1]) % Или операция нарушит границы хранилищ
\/ % при увеличении интенсивности.
(is_fixed[op, t]) % Или операция фиксирована.
)
);
% Критерий оптимизации
array [1..(n_intervals + 1)] of var bool : is_not_terminated;
% В конце всё остановится.
......
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