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

How do you filter to only return solvable == x #222

Open
Affie opened this issue Nov 27, 2019 · 7 comments
Open

How do you filter to only return solvable == x #222

Affie opened this issue Nov 27, 2019 · 7 comments

Comments

@Affie
Copy link
Member

Affie commented Nov 27, 2019

No description provided.

@GearsAD
Copy link
Collaborator

GearsAD commented Nov 27, 2019

As per #201:

Using solvable in this way means that it's a lower bound when filtering - filtering on solvable=0 means that you'll get both solvable=1 and solvable=0. That is correct?
DF correct

At present there isn't a way to query unsolved nodes.

@Affie
Copy link
Member Author

Affie commented Nov 28, 2019

Ok, I missed the reasoning behind it. What about a compromise.

  • use an Array{Int} = [] or
  • use an UnitRange{Int64}

eg.

function _isSolvable(dfg::LightDFG, label::Symbol, ready::Array{Int})::Bool
	haskey(dfg.g.variables, label) && (return dfg.g.variables[label].solvable in ready)
	haskey(dfg.g.factors, label) && (return dfg.g.factors[label].solvable in ready)

...

@Affie Affie added this to the v0.6.x milestone Feb 7, 2020
@GearsAD
Copy link
Collaborator

GearsAD commented Feb 8, 2020

Thinking about this - if filtering solvable==0 is needed, I'd suggest we don't use the lower limit then. Rather we switch it to an equality check than introduce the array?

@Affie
Copy link
Member Author

Affie commented Feb 24, 2020

I came across another case here #331. Maybe == will work better as you said. However, I don't understand the reason behind > so hesitant to change.

@dehann
Copy link
Member

dehann commented Apr 27, 2020

Think we resolved this in a previous discussion? The main idea is/was that there are levels of solvable. The way I find solvable == 0 is to use setdiff(ls(fg,solvable=0), ls(fg, solvable=1)). Its working well enough for the time being that we can close this issue?

@dehann dehann modified the milestones: v0.7.x, v0.7.6 Apr 27, 2020
@Affie Affie modified the milestones: v0.7.6, v0.8.x May 1, 2020
@dehann
Copy link
Member

dehann commented May 2, 2020

understand the reason behind > so hesitant to change.

We need a way to search for multiple values of solvable at once, and rather than doing a ton of x in list it seemed more sensible to work with an Int and < or >. So ls(fg, solvable=0) will include all 0 <= val -- i.e. ==0, ==1, ==2, etc.

The easiest way then is to use setdiff for only getting ==0 but excluding ==1 or ==0 cases. However, this way is easier to get just solvables and skip unsolvables.

@Affie Affie modified the milestones: v0.8.x, v0.8.1 May 17, 2020
@dehann dehann modified the milestones: v0.8.1, v0.0.x Jul 6, 2020
@Affie
Copy link
Member Author

Affie commented Oct 21, 2024

I propose we allow users to choose with a by::Function = > kwarg, generally supporting [<,>,<=,>=,==]. In DFG we can support any appropriate function such as the set functions (eg. in).

@Affie Affie changed the title How do you filter to only return solvable == 0 How do you filter to only return solvable == x Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants