Add hard limits (-5 to +2) and never test after these times
This commit is contained in:
parent
574aa7dcc3
commit
06bf5cc446
17
dlmo.mzn
17
dlmo.mzn
@ -30,15 +30,21 @@ array[Patient] of var bool: first_detected = [
|
|||||||
| pt in Patient
|
| pt in Patient
|
||||||
];
|
];
|
||||||
|
|
||||||
% --- Constraint ---
|
enum Status = { First, ShiftBack, ShiftForward };
|
||||||
|
array[Patient] of var Status: status;
|
||||||
|
|
||||||
|
% --- Constraint ---
|
||||||
% The DLMO should be detected on the second occasion (if not detected on the first occasion)
|
% The DLMO should be detected on the second occasion (if not detected on the first occasion)
|
||||||
constraint forall (pt in Patient) (
|
constraint forall (pt in Patient) (
|
||||||
first_detected[pt]
|
if status[pt] = First then
|
||||||
|
first_detected[pt]
|
||||||
|
elseif status[pt] = ShiftBack then
|
||||||
% Before first occasion
|
% Before first occasion
|
||||||
\/ (critical_sample[pt] >= first_sample - (second_num_samples - 1) /\ critical_sample[pt] + 1 <= first_sample)
|
(critical_sample[pt] >= first_sample - (second_num_samples - 1) /\ critical_sample[pt] + 1 <= first_sample)
|
||||||
|
else
|
||||||
% After first occasion
|
% After first occasion
|
||||||
\/ (critical_sample[pt] >= first_sample + (first_num_samples - 1) /\ critical_sample[pt] + 1 <= first_sample + (first_num_samples - 1) + (second_num_samples - 1))
|
(critical_sample[pt] >= first_sample + (first_num_samples - 1) /\ critical_sample[pt] + 1 <= first_sample + (first_num_samples - 1) + (second_num_samples - 1))
|
||||||
|
endif
|
||||||
);
|
);
|
||||||
|
|
||||||
% --- Objective ---
|
% --- Objective ---
|
||||||
@ -46,7 +52,8 @@ solve minimize
|
|||||||
% Number of tests on first occasion
|
% Number of tests on first occasion
|
||||||
(length(Patient) * first_num_samples)
|
(length(Patient) * first_num_samples)
|
||||||
% Number of test on second occasion
|
% Number of test on second occasion
|
||||||
+ (count(pt in Patient) (not first_detected[pt]) * second_num_samples);
|
+ (count(pt in Patient) (status[pt] = ShiftBack) * min(second_num_samples, first_sample - min(Horizon) + 1))
|
||||||
|
+ (count(pt in Patient) (status[pt] = ShiftForward) * min(second_num_samples, max(Horizon) - (first_sample + (first_num_samples -1) + 1)));
|
||||||
|
|
||||||
% --- Output ---
|
% --- Output ---
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user