diff --git a/src/constraints/conversion_2.mzn b/src/constraints/conversion_2.mzn index 0d639754a772d63f139f76fe4e3a62f7b32e4942..2bfa195de2c5f598e04acc5c4d2350968391d95c 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 49476394183ae5bb06ab22076bd5e427642ed069..0b6e9c9980226b1bc652c02fb316e44d744477f3 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",