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

Error thrown on simple equation #3

Open
victorBaro opened this issue May 8, 2024 · 0 comments
Open

Error thrown on simple equation #3

victorBaro opened this issue May 8, 2024 · 0 comments

Comments

@victorBaro
Copy link

Thanks for this library, is working really well in many cases.

I am facing an issue though with a specific case:

        let solver: Solver = Solver()
        
        let row0 = Variable("row_0")
        let row1 = Variable("row_1")
        let row2 = Variable("row_2")
        let row3 = Variable("row_3")

        do {
            try solver.add(constraint: row0 == row1)
            try solver.add(constraint: row2 == row3)
            try solver.add(constraint: row0 + row1 + row2 + row3 == 240)
            try solver.add(constraint: row0 + row1 == 120)
            try solver.add(constraint: row2 + row3 == 120)
        } catch {
            throw error
        }

This simple equation is raising an error: caught error: "unable to satisfy constraint: 1.0 * row_2 + 1.0 * row_3 + -120.0 == 0

If I set any of the last 3 constraints as .strong (instead of required), the solver is able to resolve (all variable values are 60).

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