Skip to content

Set Expressions (with Chainable Format) for Arithmetic and Relational Operations#1171

Open
cprudhom wants to merge 5 commits into
developfrom
dev_setexpr
Open

Set Expressions (with Chainable Format) for Arithmetic and Relational Operations#1171
cprudhom wants to merge 5 commits into
developfrom
dev_setexpr

Conversation

@cprudhom
Copy link
Copy Markdown
Member

This PR takes the work from @gadavidd (#1107) and extracts the 4 impacting commits and places them back on the up-to-date develop branch.

gadavidd and others added 4 commits August 29, 2025 10:40
… existing structure for integer expressions.

+ update headers
Suggestion of improvements: detect constraints like `partition(SetVar[] sets, SetVar universe)`
return model.allEqual(xSet, ySet);
case NE:
return model.allDifferent(xSet, ySet);
case CONTAINS:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why having both SUBSET and CONTAINS ?
I think I prefer subset

case CONTAINS:
return model.subsetEq(ySet, xSet);
case NOT_CONTAINS:
return model.disjoint(xSet, ySet);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if contains(x, y) means that y is a subset of x
I would expect not_contains(x, y) to mean that y is not a subset of x, which does not mean that both sets are disjoint. They might have one value in common.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not necessarily. How would you express the following constraint otherwise ? "x should not contain the values of y ?"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would use the term disjoint for that. It is much clearer.
"Should not contain the values of y" is confusing because a value of a set variable is a set.
Let say X has 2 solutions : {2,3} and {2,5,7}. If Y = {2}, then it does not contain the values of X. Yet, I guess it is not what you meant, you want both variables to have disjoint values.
Also, to contain is a directed concept (A contains B is different from B contains A) whereas disjointness is not.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I see what you mean. Therefore, I agree that DISJOINT should be a better name than NOT_CONTAINS

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I agree as well. When I wrote this term, I was thinking from a user’s perspective. In that context, “contains” and “not contains” are more commonly used, but they introduce ambiguity. Using “subset” and “disjoint” makes the intended behavior much clearer.


/**
* Basic
* ============= Relacional ============= values and sets
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

typo: "Relational"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Portuguese, sorry

* Empty
*/

@Test
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should not it be a test from TestNG (more especially one of the "1s" category) ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes, I changed it


assertArrayEquals(new int[]{1, 2, 3, 4, 5}, setA.getUB().toArray());

setA.notEmpty().post();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this relevant for the test ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You're right, this is not relevant. I removed it.

@cprudhom
Copy link
Copy Markdown
Member Author

cprudhom commented Sep 2, 2025

@gadavidd Even if I created the PR and revamp the code a little, this is your work.
Would you mind to consider the comments here and integrate them in a new commit on this branch?

@cprudhom cprudhom modified the milestones: 5.0.0, 5.0.1 Feb 2, 2026
@cprudhom cprudhom modified the milestones: 5.0.1, unknown Apr 10, 2026
@gadavidd
Copy link
Copy Markdown

@cprudhom Sure, sorry for the delay; I had some personal issues, but I am now reviewing the comments and will integrate the required changes in a new commit on this branch.

@gadavidd
Copy link
Copy Markdown

gadavidd commented May 1, 2026

@cprudhom @ArthurGodet @jgFages I addressed the review comments, but I do not have permission to push to dev_setexpr. I pushed the changes to my fork and opened PR #1196 with the updates.

#1197

@cprudhom
Copy link
Copy Markdown
Member Author

cprudhom commented May 6, 2026

I think the PR is ready to be merged.
@jgFages @ArthurGodet any additional comments?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants