Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a simplified version of td3 with warrowing #1611

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arkocal
Copy link

@arkocal arkocal commented Oct 31, 2024

The simplified warrowing solver as implemented by @FelixKrayer .

Since changes were intervened in many commits with other changes, it would have been too much effort to keep authorship information on git and I have copied the file instead. Maybe Felix can open an issue with the same change.

As to which solver we should keep as the simplified version, this one:

  1. Can be documented a little more for didactic purposes, but I find it to be very readable as is.
  2. We should find the paper most closely matching this solver
  3. This one does not pass all tests due to warrowing.

@sim642 sim642 self-requested a review October 31, 2024 13:19
Comment on lines +1 to +5
(** Terminating op-down solver with side effects. Baseline for comparisons with td_parallel solvers ([td_simplified]).*)

(** Top down solver that uses the box-operator for widening/narrowing at widening points.
* Options:
* - solvers.td3.remove-wpoint (default: true): Remove widening points when a variable is and stays stable in iterate. Increases precision of nested loops.*)
Copy link
Member

@sim642 sim642 Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how much we want to iterate on this. This solver isn't too important to us, but it's supposed to be didactic, so maybe we should spend time polishing this.
The following thoughts are first for discussion than immediate requests for changes.

Anyway, if it's "terminating" then it cannot be the warrowing version (which is non-terminating). The first improvement of TD3 is the termination by switching from warrowing to widen/narrow phases. Personally, I would prefer the phased version instead of warrowing: it's not really more complicated (just one argument to solve).

As to the remove-wpoint improvement, I wouldn't have it in this simplified version because it is niche not necessary for the simple presentation.

Comment on lines +21 to +39
type solver_data = {
infl: VS.t HM.t;
rho: S.Dom.t HM.t;
wpoint: unit HM.t;
stable: unit HM.t;
}

let create_empty_data () = {
infl = HM.create 10;
rho = HM.create 10;
wpoint = HM.create 10;
stable = HM.create 10;
}

let print_data data =
Logs.debug "|rho|=%d" (HM.length data.rho);
Logs.debug "|stable|=%d" (HM.length data.stable);
Logs.debug "|infl|=%d" (HM.length data.infl);
Logs.debug "|wpoint|=%d" (HM.length data.wpoint)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These being in a record was needed for incremental marshaling in TD3, but this isn't incremental, so I'd just have normal variables for these (like in all other solvers).

Comment on lines +95 to +96
let rec iterate ?reuse_eq x = (* ~(inner) solve in td3*)
let query x y = (* ~eval in td3 *)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason that query and side are inside iterate/solve here? This makes iterate (which begins a long way down) quite large, which is also apparent from the need to explicitly comment where iterate begins. And the x argument of iterate is always the x argument of query/side, so there's unnecessary duplication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants