Talk:Sponsored Development: Finite Capacity Non-preemptive Scheduling
From ADempiere
This Wiki is read-only for reference purposes to avoid broken links.
11/21/2007 Activity
Experimenting with the ic library of eclipse-clp. I have found a way to compose a set of domains and do an intersection on them with:
ic:(X::[0..5, 15..20, 25..30]), ic:(Y::[200..800, 2000..2600]), ic:(get_domain_as_list(X, Upb1)), ic:(get_domain_as_list(Y,Upb2)), ic_sets:(Set1 :: []..Upb1), ic_sets:(Set2 :: []..Upb2), in(I, Set1 /\ Set2, B), B =1. Outputs: No ic:(X::[0..5, 15..20, 25..30]), ic:(Y::[2..8, 20..26]), ic:(get_domain_as_list(X, Upb1)), ic:(get_domain_as_list(Y,Upb2)), ic_sets:(Set1 :: []..Upb1), ic_sets:(Set2 :: []..Upb2), in(I, Set1 /\ Set2, B), B =1. outputs: X = X{[0 .. 5, 15 .. 20, 25 .. 30]} Y = Y{[2 .. 8, 20 .. 26]} Upb1 = [0, 1, 2, 3, 4, 5, 15, 16, 17, 18, 19, 20, 25, 26, 27, 28, 29, 30] Upb2 = [2, 3, 4, 5, 6, 7, 8, 20, 21, 22, 23, 24, 25, 26] Set1 = Set1{([] .. [0, 1, 2, 3, 4, 5, 15, 16, 17, 18, 19, 20, 25, 26, 27, 28, ...]) : _1120{0 .. 18}} Set2 = Set2{([] .. [2, 3, 4, 5, 6, 7, 8, 20, 21, 22, 23, 24, 25, 26]) : _1316{0 .. 14}} I = I{[2 .. 5, 20, 25, 26]} B = 1 There are 7 delayed goals. Yes (0.00s cpu) ic:(X::[0..5, 15..20, 25..30]), ic:(Y::[2..8, 20..26]), ic:(get_domain_as_list(X, Upb1)), ic:(get_domain_as_list(Y,Upb2)), ic_sets:(Set1 :: []..Upb1), ic_sets:(Set2 :: []..Upb2), in(I, Set1 /\ Set2, B), B=1 -> writeln('in');writeln('out'). outputs: X = X{[0 .. 5, 15 .. 20, 25 .. 30]} Y = Y{[2 .. 8, 20 .. 26]} Upb1 = [0, 1, 2, 3, 4, 5, 15, 16, 17, 18, 19, 20, 25, 26, 27, 28, 29, 30] Upb2 = [2, 3, 4, 5, 6, 7, 8, 20, 21, 22, 23, 24, 25, 26] Set1 = Set1{([] .. [0, 1, 2, 3, 4, 5, 15, 16, 17, 18, 19, 20, 25, 26, 27, 28, ...]) : _1167{0 .. 18}} Set2 = Set2{([] .. [2, 3, 4, 5, 6, 7, 8, 20, 21, 22, 23, 24, 25, 26]) : _1363{0 .. 14}} I = I{[2 .. 5, 20, 25, 26]} B = 1 There are 7 delayed goals. Yes (0.00s cpu) text output: in ic:(X::[0..5, 15..20, 25..30]), ic:(Y::[200..800, 2000..2600]), ic:(get_domain_as_list(X, Upb1)), ic:(get_domain_as_list(Y,Upb2)), ic_sets:(Set1 :: []..Upb1), ic_sets:(Set2 :: []..Upb2), in(I, Set1 /\ Set2, B), B=1 -> writeln('in');writeln('out'). outputs: X = X Y = Y Upb1 = Upb1 Upb2 = Upb2 Set1 = Set1 Set2 = Set2 I = I B = B Yes (0.04s cpu) text output: out
Activity on 11/24/2007
How to determine the size of an intset:
intset(Set, 1, 8), #(Set,Card), writeln(Card), get_domain_size(Card, Size), writeln(Size). ?- intset(Set, 1, 8), #(Set, Card), writeln(Card), get_domain_size(Card, Size), writeln(Size). Set = Set{([] .. [1, 2, 3, 4, 5, 6, 7, 8]) : Card{0 .. 8}} Card = Card{0 .. 8} Size = 9 There is 1 delayed goal. Yes (0.00s cpu) Card{0 .. 8} 9
How to make multiple non-contiguous sets of numbers into a set and determine their size:
ic:(X::[0..2, 5..7]), get_domain_as_list(X, List), writeln(List), ic_sets:(Set:: []..List), writeln(Set), #(Set,Card), writeln(Card), get_domain_size(Card, Size), writeln(Size). X = X{[0 .. 2, 5 .. 7]} List = [0, 1, 2, 5, 6, 7] Set = Set{([] .. [0, 1, 2, 5, 6, 7]) : Card{0 .. 6}} Card = Card{0 .. 6} Size = 7 There is 1 delayed goal. Yes (0.01s cpu) [0, 1, 2, 5, 6, 7] Set{([] .. [0, 1, 2, 5, 6, 7]) : _732{0 .. 6}} Card{0 .. 6} 7
How to handle infinite domains:
ic:(X::0..inf), ic:(X#>=10), ic:(X#=<15). gives: X = X{10 .. 15}