We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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
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).
.strong
The text was updated successfully, but these errors were encountered:
I am not sure how your code is actually written, but i add the following code to the unit test, it did pass the test."
func testSetRestricted2(){
let solver: SimplexSolver = SimplexSolver() let row0 = Variable.restricted() let row1 = Variable.restricted() let row2 = Variable.restricted() let row3 = Variable.restricted() XCTAssertNoThrow(try solver.add(constraint: row0 == row1)) XCTAssertNoThrow(try solver.add(constraint: row2 == row3)) XCTAssertNoThrow(try solver.add(constraint: row0 + row1 + row2 + row3 == 240)) XCTAssertNoThrow(try solver.add(constraint: row0 + row1 == 120)) XCTAssertNoThrow(try solver.add(constraint: row2 + row3 == 120)) XCTAssertNoThrow(try solver.solve()) XCTAssertEqual(solver.valueFor(row0) , 60) XCTAssertEqual(solver.valueFor(row1) , 60) XCTAssertEqual(solver.valueFor(row2) , 60) XCTAssertEqual(solver.valueFor(row3) , 60)
}
Sorry, something went wrong.
No branches or pull requests
Thanks for this library, is working really well in many cases.
I am facing an issue though with a specific case:
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).The text was updated successfully, but these errors were encountered: