Change naming to use "round" instead of "occasion"
This commit is contained in:
parent
a08593730c
commit
4bc44838a4
32
dlmo.mzn
32
dlmo.mzn
@ -8,23 +8,23 @@ array[Patient, Horizon] of float: sample;
|
|||||||
|
|
||||||
% --- Derived data ---
|
% --- Derived data ---
|
||||||
|
|
||||||
% For each patient: after which sample could we stop and have found dlmo? (occasion must then include `critical_test[PT]` and its successor to catch it).
|
% For each patient: after which sample could we stop and have found dlmo? (round must then include `critical_test[PT]` and its successor to catch it).
|
||||||
array[Patient] of var Horizon: critical_sample = [ min([i | i in -5..1 where sample[pt, i] <= DLMO_threshold /\ sample[pt, i+1] >= DLMO_threshold]) | pt in Patient];
|
array[Patient] of var Horizon: critical_sample = [ min([i | i in -5..1 where sample[pt, i] <= DLMO_threshold /\ sample[pt, i+1] >= DLMO_threshold]) | pt in Patient];
|
||||||
|
|
||||||
% --- Decisions ---
|
% --- Decisions ---
|
||||||
% First occasion:
|
% First round:
|
||||||
var Horizon: first_sample; % When to start sampling on the first occasion
|
var Horizon: first_sample; % When to start sampling on the first round
|
||||||
var 2..length(Horizon): first_num_samples; % How many samples to take on the first occasion
|
var 2..length(Horizon): first_num_samples; % How many samples to take on the first round
|
||||||
|
|
||||||
% Second occasion:
|
% Second round:
|
||||||
var 2..length(Horizon): second_num_samples; % How many samples to take on the second occasion
|
var 2..length(Horizon): second_num_samples; % How many samples to take on the second round
|
||||||
|
|
||||||
% (Assumption: If the levels were to high in all samples during the first occasion, then we sample `second_num_samples` ending with the `first_sample`.
|
% (Assumption: If the levels were to high in all samples during the first round, then we sample `second_num_samples` ending with the `first_sample`.
|
||||||
% If the levels were to low in all samples during the first occasion, then we sample `second_num_samples` from `first_sample + first_num_samples`.)
|
% If the levels were to low in all samples during the first round, then we sample `second_num_samples` from `first_sample + first_num_samples`.)
|
||||||
|
|
||||||
% --- Decision Consequences ---
|
% --- Decision Consequences ---
|
||||||
|
|
||||||
% For each patient: will their DLMO be detected on the first occasion?
|
% For each patient: will their DLMO be detected on the first round?
|
||||||
array[Patient] of var bool: first_detected = [
|
array[Patient] of var bool: first_detected = [
|
||||||
critical_sample[pt] >= first_sample /\ critical_sample[pt] + 1 <= first_sample + (first_num_samples - 1)
|
critical_sample[pt] >= first_sample /\ critical_sample[pt] + 1 <= first_sample + (first_num_samples - 1)
|
||||||
| pt in Patient
|
| pt in Patient
|
||||||
@ -32,29 +32,29 @@ array[Patient] of var bool: first_detected = [
|
|||||||
|
|
||||||
% --- Constraint ---
|
% --- 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 round (if not detected on the first round)
|
||||||
constraint forall (pt in Patient) (
|
constraint forall (pt in Patient) (
|
||||||
first_detected[pt]
|
first_detected[pt]
|
||||||
% Before first occasion
|
% Before first round
|
||||||
\/ (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)
|
||||||
% After first occasion
|
% After first round
|
||||||
\/ (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))
|
||||||
);
|
);
|
||||||
|
|
||||||
% --- Objective ---
|
% --- Objective ---
|
||||||
solve minimize
|
solve minimize
|
||||||
% Number of tests on first occasion
|
% Number of tests on first round
|
||||||
(length(Patient) * first_num_samples)
|
(length(Patient) * first_num_samples)
|
||||||
% Number of test on second occasion
|
% Number of test on second round
|
||||||
+ (count(pt in Patient) (not first_detected[pt]) * second_num_samples);
|
+ (count(pt in Patient) (not first_detected[pt]) * second_num_samples);
|
||||||
|
|
||||||
% --- Output ---
|
% --- Output ---
|
||||||
|
|
||||||
output ["First Occasion:\n"]
|
output ["First Round:\n"]
|
||||||
++ [format(2, i) ++ " " | i in Horizon] ++ ["\n |"]
|
++ [format(2, i) ++ " " | i in Horizon] ++ ["\n |"]
|
||||||
++ [if i in fix(first_sample)..fix(first_sample + (first_num_samples-1) - 1) then "====|" else "----|" endif | i in -5..1]
|
++ [if i in fix(first_sample)..fix(first_sample + (first_num_samples-1) - 1) then "====|" else "----|" endif | i in -5..1]
|
||||||
++ ["\n\nFirst try (%): \(count(first_detected) / length(Patient) * 100)\n"]
|
++ ["\n\nFirst try (%): \(count(first_detected) / length(Patient) * 100)\n"]
|
||||||
++ ["\n\nSecond Occasion:\n"]
|
++ ["\n\nSecond Round:\n"]
|
||||||
++ [format(2, i) ++ " " | i in Horizon] ++ ["\n |"]
|
++ [format(2, i) ++ " " | i in Horizon] ++ ["\n |"]
|
||||||
++ [if i in fix(first_sample-(second_num_samples-1))..fix(first_sample-1) \/ i in fix(first_sample + (first_num_samples - 1))..fix(first_sample + (first_num_samples - 1) + (second_num_samples - 1) - 1) then "====|" else "----|" endif | i in -5..1]
|
++ [if i in fix(first_sample-(second_num_samples-1))..fix(first_sample-1) \/ i in fix(first_sample + (first_num_samples - 1))..fix(first_sample + (first_num_samples - 1) + (second_num_samples - 1) - 1) then "====|" else "----|" endif | i in -5..1]
|
||||||
++ ["\n\nTotal number of tests = \(_objective);"]
|
++ ["\n\nTotal number of tests = \(_objective);"]
|
||||||
|
112
output.txt
112
output.txt
@ -1,83 +1,47 @@
|
|||||||
First Occasion:
|
First Round:
|
||||||
-5 -4 -3 -2 -1 0 1 2
|
|
||||||
|----|----|----|====|====|====|----|
|
|
||||||
|
|
||||||
First try (%): 41.75824175824176
|
|
||||||
|
|
||||||
|
|
||||||
Second Occasion:
|
|
||||||
-5 -4 -3 -2 -1 0 1 2
|
|
||||||
|====|====|====|----|----|----|====|
|
|
||||||
|
|
||||||
Total number of tests = 1470;
|
|
||||||
|
|
||||||
|
|
||||||
first_sample = -2;
|
|
||||||
first_num_samples = 4;
|
|
||||||
second_num_samples = 7;
|
|
||||||
----------
|
|
||||||
First Occasion:
|
|
||||||
-5 -4 -3 -2 -1 0 1 2
|
|
||||||
|----|----|----|====|----|----|----|
|
|
||||||
|
|
||||||
First try (%): 29.12087912087912
|
|
||||||
|
|
||||||
|
|
||||||
Second Occasion:
|
|
||||||
-5 -4 -3 -2 -1 0 1 2
|
|
||||||
|====|====|====|----|====|====|====|
|
|
||||||
|
|
||||||
Total number of tests = 1009;
|
|
||||||
|
|
||||||
|
|
||||||
first_sample = -2;
|
|
||||||
first_num_samples = 2;
|
|
||||||
second_num_samples = 5;
|
|
||||||
----------
|
|
||||||
First Occasion:
|
|
||||||
-5 -4 -3 -2 -1 0 1 2
|
|
||||||
|----|----|----|====|----|----|----|
|
|
||||||
|
|
||||||
First try (%): 29.12087912087912
|
|
||||||
|
|
||||||
|
|
||||||
Second Occasion:
|
|
||||||
-5 -4 -3 -2 -1 0 1 2
|
|
||||||
|====|====|====|----|====|====|====|
|
|
||||||
|
|
||||||
Total number of tests = 880;
|
|
||||||
|
|
||||||
|
|
||||||
first_sample = -2;
|
|
||||||
first_num_samples = 2;
|
|
||||||
second_num_samples = 4;
|
|
||||||
----------
|
|
||||||
First Occasion:
|
|
||||||
-5 -4 -3 -2 -1 0 1 2
|
|
||||||
|----|====|====|====|----|----|----|
|
|
||||||
|
|
||||||
First try (%): 78.57142857142857
|
|
||||||
|
|
||||||
|
|
||||||
Second Occasion:
|
|
||||||
-5 -4 -3 -2 -1 0 1 2
|
|
||||||
|====|----|----|----|====|====|----|
|
|
||||||
|
|
||||||
Total number of tests = 845;
|
|
||||||
|
|
||||||
|
|
||||||
first_sample = -4;
|
|
||||||
first_num_samples = 4;
|
|
||||||
second_num_samples = 3;
|
|
||||||
----------
|
|
||||||
First Occasion:
|
|
||||||
-5 -4 -3 -2 -1 0 1 2
|
-5 -4 -3 -2 -1 0 1 2
|
||||||
|----|----|====|====|----|----|----|
|
|----|----|====|====|----|----|----|
|
||||||
|
|
||||||
First try (%): 54.94505494505495
|
First try (%): 54.94505494505495
|
||||||
|
|
||||||
|
|
||||||
Second Occasion:
|
Second Round:
|
||||||
|
-5 -4 -3 -2 -1 0 1 2
|
||||||
|
|====|====|----|----|====|====|====|
|
||||||
|
|
||||||
|
Total number of tests = 1038;
|
||||||
|
|
||||||
|
|
||||||
|
first_sample = -3;
|
||||||
|
first_num_samples = 3;
|
||||||
|
second_num_samples = 6;
|
||||||
|
----------
|
||||||
|
First Round:
|
||||||
|
-5 -4 -3 -2 -1 0 1 2
|
||||||
|
|----|----|====|====|----|----|----|
|
||||||
|
|
||||||
|
First try (%): 54.94505494505495
|
||||||
|
|
||||||
|
|
||||||
|
Second Round:
|
||||||
|
-5 -4 -3 -2 -1 0 1 2
|
||||||
|
|====|====|----|----|====|====|====|
|
||||||
|
|
||||||
|
Total number of tests = 874;
|
||||||
|
|
||||||
|
|
||||||
|
first_sample = -3;
|
||||||
|
first_num_samples = 3;
|
||||||
|
second_num_samples = 4;
|
||||||
|
----------
|
||||||
|
First Round:
|
||||||
|
-5 -4 -3 -2 -1 0 1 2
|
||||||
|
|----|----|====|====|----|----|----|
|
||||||
|
|
||||||
|
First try (%): 54.94505494505495
|
||||||
|
|
||||||
|
|
||||||
|
Second Round:
|
||||||
-5 -4 -3 -2 -1 0 1 2
|
-5 -4 -3 -2 -1 0 1 2
|
||||||
|====|====|----|----|====|====|----|
|
|====|====|----|----|====|====|----|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user