diff --git a/src/constraints/conversion_2.mzn b/src/constraints/conversion_2.mzn index 5a9344392c9a388efa6d7996fc02d9abec7a1de5..0d639754a772d63f139f76fe4e3a62f7b32e4942 100644 --- a/src/constraints/conversion_2.mzn +++ b/src/constraints/conversion_2.mzn @@ -366,6 +366,7 @@ array [0..n_operations] of 0..n_locations : operations_destination; % Локац array [1..n_fixed_op] of set of 1..n_moving_obj : fixed_op_resources; array [1..n_fixed_op] of 1..n_intervals : fixed_op_start; array [1..n_fixed_op] of 1..n_intervals : fixed_op_end; % Включительно. + array [1..n_fixed_op] of int : fixed_op_intensity; array [0..n_operations, 0..n_intervals] of bool : is_fixed; diff --git a/src/constraints/conversion_2_with_partial_cargo_operations.mzn b/src/constraints/conversion_2_with_partial_cargo_operations.mzn index 97a188889a3260535ea1190bd5e036de9b74429e..49476394183ae5bb06ab22076bd5e427642ed069 100644 --- a/src/constraints/conversion_2_with_partial_cargo_operations.mzn +++ b/src/constraints/conversion_2_with_partial_cargo_operations.mzn @@ -367,18 +367,7 @@ array [0..n_operations] of 0..n_locations : operations_destination; % Локац constraint forall (op in 1..n_operations, t in 0..(n_intervals + 1) where not is_moving_operation[op]) ( op_status[op, t] -> (cargo_op_intensity[op, t] > 0) ); -/* - constraint forall (storage in 1..n_obj_with_storage, cargo in 1..n_cargo_types, t in 1..(n_intervals + 1)) ( - storage_used_volume[storage, t, cargo] = ( - storage_used_volume[storage, t - 1, cargo] + - cargo_flows[storage, t, cargo] + - sum (inv_op in involved_operations[storage, cargo]) ( - loading_op_delta[inv_op] * - op_status[loading_op_n[inv_op], t] - ) - ) - ); -*/ + constraint forall (storage in 1..n_obj_with_storage, cargo in 1..n_cargo_types, t in 1..(n_intervals + 1)) ( storage_used_volume[storage, t, cargo] = ( storage_used_volume[storage, t - 1, cargo] + @@ -397,6 +386,7 @@ array [0..n_operations] of 0..n_locations : operations_destination; % Локац array [1..n_fixed_op] of set of 1..n_moving_obj : fixed_op_resources; array [1..n_fixed_op] of 1..n_intervals : fixed_op_start; array [1..n_fixed_op] of 1..n_intervals : fixed_op_end; % Включительно. + array [1..n_fixed_op] of int : fixed_op_intensity; array [0..n_operations, 0..n_intervals] of bool : is_fixed; @@ -405,7 +395,8 @@ array [0..n_operations] of 0..n_locations : operations_destination; % Локац (op_status[op, t]) /\ forall (obj in fixed_op_resources[no]) ( participation_as_resource[obj, t] = op - ) + ) /\ + (cargo_op_intensity[op, t] = fixed_op_intensity[no]) ) ); diff --git a/src/inport/ConversionUtil.java b/src/inport/ConversionUtil.java index 4f8ee9831483286a12491ee85ed7ac79dd130489..6b9872abf52a741a08a5b26fb30428371271868d 100644 --- a/src/inport/ConversionUtil.java +++ b/src/inport/ConversionUtil.java @@ -1308,6 +1308,7 @@ public class ConversionUtil { ArrayList> fixedOpResources = new ArrayList<>(); ArrayList fixedOpStart = new ArrayList<>(); ArrayList fixedOpEnd = new ArrayList<>(); + ArrayList fixedOpIntensity = new ArrayList<>(); class OperationData implements Comparable { private int opId, executorId; @@ -1359,6 +1360,7 @@ public class ConversionUtil { fixedOpResources.add(resources); fixedOpStart.add((int)Math.floor(op.getStart()) + 1); fixedOpEnd.add((int)Math.ceil(op.getDuration() + op.getStart())); + fixedOpIntensity.add((int)Math.ceil(op.getIntensity().orElse(0))); } } @@ -1367,6 +1369,7 @@ public class ConversionUtil { writeArray(writer, "fixed_op_resources", fixedOpResources, ConversionUtil::setToString); writeArray(writer, "fixed_op_start", fixedOpStart); writeArray(writer, "fixed_op_end", fixedOpEnd); + writeArray(writer, "fixed_op_intensity", fixedOpIntensity); locWrite2DArray(writer, "is_fixed", getIsFixedArray(), Objects::toString, true); }