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

[Constraint] Introduce ConstraintSystemReference idea for friendly API #95

Open
3 tasks
alxiong opened this issue Aug 9, 2022 · 0 comments
Open
3 tasks

Comments

@alxiong
Copy link
Contributor

alxiong commented Aug 9, 2022

From @zhenfeizhang in #94 (comment)

In general I want to advocate my "circuit ref" idea. For example

struct BoolVar<'a> {
  index: Variable,
  cs: &'a ConstraintSystem
}

On top of overloading operators here are some additional thoughts:

  • to access the variable, we should use an API get_index(&self)->Variable -- i think it is a bit cleaner than into()
    • it makes more sense to me to implement Into/From for Vec<BoolVar> and Variable, in both directions, which are binary (de)composition
  • to create new variables we should use associated function BoolVar::new(cs: &ConstraintSystem, value: bool) rather than Circuit::create_bool_variable(...) and so on...
  • to check variable bound we can simply call bool_var.check_bound(), and we do not need to pass parameters
  • add CSRef for BoolVar
  • add CSRef for PointVar
  • add CSRef for Variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant