Skip to content

Commit

Permalink
Self-review
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Sep 21, 2024
1 parent 064de12 commit cdeeb04
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
1 change: 1 addition & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Test of solver timeout behaviors
8 changes: 3 additions & 5 deletions src/alire/alire-solver.adb
Original file line number Diff line number Diff line change
Expand Up @@ -678,9 +678,7 @@ package body Alire.Solver is
-- Prefer states with fewer pending dependencies. This is simply to
-- steer the search towards complete solutions first.

case Compare (L.Target.Leaf_Count + L.Remaining.Leaf_Count,
R.Target.Leaf_Count + R.Remaining.Leaf_Count)
is
case Compare (Pending_Count (L), Pending_Count (R)) is
when Left => return True;
when Right => return False;
when Equal => null;
Expand Down Expand Up @@ -951,7 +949,7 @@ package body Alire.Solver is
raise Program_Error with "Search state lost!";
end if;

if This.Target.Is_Empty and then This.Remaining.Is_Empty then
if Pending_Count (This.all) = 0 then
Store_Solution (State_Ptr'(This.all'Unchecked_Access));
end if;
end Enqueue;
Expand Down Expand Up @@ -1721,7 +1719,7 @@ package body Alire.Solver is
declare
Head : constant State_Ptr := States.First_Element;
begin
if Head.Target.Is_Empty and then Head.Remaining.Is_Empty
if Pending_Count (Head.all) = 0
and then
not Contains_All_Satisfiable (States.First_Element.To_Solution)
then
Expand Down
5 changes: 1 addition & 4 deletions src/alire/alire-solver.ads
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,7 @@ package Alire.Solver is
end record;

Default_Options : constant Query_Options := (others => <>);
-- Default options is to keep looking without asking. This is potentially
-- more time consuming but it should be safe in the sense that no spurious
-- incomplete solutions should be returned. When interaction/early stop is
-- preferred, it must be tweaked (see child package Predefined_Options).
-- Default options is to ask on timeout

-- See child package Predefined_Options for more.

Expand Down

0 comments on commit cdeeb04

Please sign in to comment.