From ecec647039195a02bdc6a58c8afdd3e9076e23b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=81=D0=B5=D0=BB=D1=91=D0=B2=20=D0=92=D0=BB?= =?UTF-8?q?=D0=B0=D0=B4=D0=B8=D1=81=D0=BB=D0=B0=D0=B2?= Date: Tue, 14 May 2019 09:24:12 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20is=5Fop=5Fpossible,=20=D0=B2=20=D1=87=D0=B0?= =?UTF-8?q?=D1=81=D1=87=D0=B8=D1=87=D0=BD=D1=8B=D1=85=20=D0=BE=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D0=B0=D1=86=D0=B8=D1=8F=D1=85=20=D0=BF=D0=B5=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D1=8C=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82?= =?UTF-8?q?=20=D0=BE=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constraints/conversion_2.mzn | 8 +++---- ...ersion_2_with_partial_cargo_operations.mzn | 21 ++++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/constraints/conversion_2.mzn b/src/constraints/conversion_2.mzn index 0d63975..2bfa195 100644 --- a/src/constraints/conversion_2.mzn +++ b/src/constraints/conversion_2.mzn @@ -417,7 +417,7 @@ array [0..n_operations] of 0..n_locations : operations_destination; % Локац (current_moving_operation[main_obj_of_operation[op], t] = 0) /\ % Главный объект не участвует в операции перемещеня. (is_enough_free_resources[op, t] = true) /\ % Достаточно свободных ресурсов на нужном месте. - (forall (conf_op in conflicting_operations[op]) (op_status[op, t] = false)) + (forall (conf_op in conflicting_operations[op]) (op_status[conf_op, t] = false)) /\ % Не выполняется ни одной конфликтующей операции. (is_moving_operation[op] -> not is_involved_in_cargo_op[main_obj_of_operation[op], t]) /\ % Если это операция перемещения, то главный объект @@ -433,14 +433,14 @@ array [0..n_operations] of 0..n_locations : operations_destination; % Локац int : delta = loading_op_delta_of_main_obj[op]; } in (storage_used_volume[m_stor, t, cargo] + delta >= 0) /\ - ((sum (c in 1..n_cargo_types) (storage_used_volume[m_stor, t, cargo])) + delta <= max_storage_vol[m_stor]) /\ + ((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, cargo])) - delta <= max_storage_vol[s_stor]) + ((sum (c in 1..n_cargo_types) (storage_used_volume[s_stor, t, c])) - delta <= max_storage_vol[s_stor]) )) /\ % Если это операция грузообработки, то она не выведет % объём берегового хранилища и хранилища судна за % границы дозволенного. (((not is_moving_operation[op]) /\ (main_obj_start_loc[op] mod 2 = 1)) -> - ((current_moored_obj[twin_location[main_obj_start_loc[op]], t] = 0) /\ + ((current_moored_obj[twin_location[main_obj_start_loc[op]], t] = 0) \/ (current_moored_obj[twin_location[main_obj_start_loc[op]], t] = main_obj_of_operation[op])) ) /\ % Если это операция грузообработки без пришвартовки, % то причал должен быть свободен в этот интервал, либо diff --git a/src/constraints/conversion_2_with_partial_cargo_operations.mzn b/src/constraints/conversion_2_with_partial_cargo_operations.mzn index 4947639..0b6e9c9 100644 --- a/src/constraints/conversion_2_with_partial_cargo_operations.mzn +++ b/src/constraints/conversion_2_with_partial_cargo_operations.mzn @@ -438,7 +438,7 @@ array [0..n_operations] of 0..n_locations : operations_destination; % Локац (current_moving_operation[main_obj_of_operation[op], t] = 0) /\ % Главный объект не участвует в операции перемещеня. (is_enough_free_resources[op, t] = true) /\ % Достаточно свободных ресурсов на нужном месте. - (forall (conf_op in conflicting_operations[op]) (op_status[op, t] = false)) + (forall (conf_op in conflicting_operations[op]) (op_status[conf_op, t] = false)) /\ % Не выполняется ни одной конфликтующей операции. (is_moving_operation[op] -> not is_involved_in_cargo_op[main_obj_of_operation[op], t]) /\ % Если это операция перемещения, то главный объект @@ -451,17 +451,18 @@ array [0..n_operations] of 0..n_locations : operations_destination; % Локац 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_delta_of_main_obj[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, cargo])) + delta <= max_storage_vol[m_stor]) /\ + ((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, cargo])) - delta <= max_storage_vol[s_stor]) + ((sum (c in 1..n_cargo_types) (storage_used_volume[s_stor, t, c])) - delta <= max_storage_vol[s_stor]) )) /\ % Если это операция грузообработки, то она не выведет % объём берегового хранилища и хранилища судна за - % границы дозволенного. + % границы дозволенного (если исполнится при минимальной + % интенсивности 1). (((not is_moving_operation[op]) /\ (main_obj_start_loc[op] mod 2 = 1)) -> - ((current_moored_obj[twin_location[main_obj_start_loc[op]], t] = 0) /\ + ((current_moored_obj[twin_location[main_obj_start_loc[op]], t] = 0) \/ (current_moored_obj[twin_location[main_obj_start_loc[op]], t] = main_obj_of_operation[op])) ) /\ % Если это операция грузообработки без пришвартовки, % то причал должен быть свободен в этот интервал, либо @@ -473,12 +474,12 @@ array [0..n_operations] of 0..n_locations : operations_destination; % Локац % и не участвует в операциях перемещения. ) ); -/* + % Сам критерий оптимизации - если если операцию можно было начать на 1 интервал раньше, то её нужно начать раньше. constraint forall (op in 1..n_operations, t in 2..n_intervals) ( (op_start[op, t] /\ (not is_fixed[op, t])) -> not is_op_possible[op, t - 1] ); -*/ + % Критерий оптимизации array [1..(n_intervals + 1)] of var bool : is_not_terminated; % В конце всё остановится. @@ -512,9 +513,9 @@ output [show(sum(is_not_terminated)), "\n", "current_moored_obj = ", show(current_moored_obj), "\n\n", "cargo_op_intensity = ", show(cargo_op_intensity), "\n\n", -/* + "is_op_possible {", show(n_intervals), "} = ", show(is_op_possible), "\n\n", - "debug_1 {", show(n_intervals), "} = ", show(debug_1), "\n\n", + /* "is_enough_free_resources {", show(n_intervals), "} = ", show(is_enough_free_resources), "\n\n", "operation_of_counter {", show(n_resources_counters), "} = ", show(operation_of_counter), "\n\n", "possible_resources_counter {", show(n_intervals), "} = ", show(possible_resources_counter), "\n\n", -- GitLab