Comments (7)
I believe @sccolbert was not worried about that at the time of writing (cf comment)
// Creating a row causes symbols to reserved for the variables
// in the constraint. If this method exits with an exception,
// then its possible those variables will linger in the var map.
// Since its likely that those variables will be used in other
// constraints and since exceptional conditions are uncommon,
// i'm not too worried about aggressive cleanup of the var map.
Tag tag;
std::auto_ptr<Row> rowptr( createRow( constraint, tag ) );
Symbol subject( chooseSubject( *rowptr, tag ) );
from kiwi.
Well, it is a major problem. We cache the constraints for the lifetime of the system, which means we assume unsatisfiable constraint exceptions will leave the solver in a consistent state (i.e. as if not added at all). The problem is when we add seemingly unrelated constraints later on, they will trigger spurious UnsatisfiableConstraint exceptions as there are some ghost rows in the solver. The fix seems to be easy as well:
// If the artificial variable is basic, pivot the row so that
// it becomes basic. If the row is constant, exit early.
RowMap::iterator it = m_rows.find( art );
if( it != m_rows.end() )
{
std::auto_ptr<Row> rowptr(it->second);
m_rows.erase(it);
if (rowptr->cells().empty())
return success;
Symbol entering(anyPivotableSymbol(*rowptr));
if (entering.type() == Symbol::Invalid)
return false; // unsatisfiable (will this ever happen?)
if (success)
{
rowptr->solveFor(art, entering);
substitute(entering, *rowptr);
m_rows[entering] = rowptr.release();
}
}
from kiwi.
Could you make a PR and add a test ideally ?
from kiwi.
ping @sccolbert
from kiwi.
IIRC (and my memory is hazy here) the problem of removing the constraint can be difficult because the tableau may have been pivoted before it can be known that the constraint is unsatisfiable. There is no logic for reversing a pivot and the parts of the constraint may be distributed across multiple rows.
from kiwi.
If you have an unsatisfiable constraint, the easiest thing to do is just create a new solver and add the known-good constraints.
from kiwi.
Thanks @sccolbert for your feedback. @bucurb if you can provide a PR (with a test ideally) I will take time to investigate in more details and review it carefully but otherwise I probably won't look at it for some time.
from kiwi.
Related Issues (20)
- Failed building wheel for kiwisolver :( HOT 4
- Cann't install on python 3.11b3 HOT 2
- 1.4.3 has no attribute __version__ HOT 2
- ERROR: Failed building wheel for kiwisolver: C2440: 'static_cast': cannot convert from 'expr_type' to 'type' HOT 2
- Provide cp311 releases HOT 1
- Objective cell memory leak? HOT 26
- Continuous fuzzing by way of Google's OSS-Fuzz HOT 1
- Tests fail on pypy
- #egg=kiwisolver See assertion error when installing kiwisolver HOT 4
- about duplicate constraints HOT 3
- Add Python API to get all constraints HOT 14
- Is it possible to get the absolute value of an expression? HOT 10
- Is it possible to tell the Solver to prefer smaller or larger solutions? HOT 3
- Missing type hint for `Constraint.violated()` HOT 1
- Python 3.12 manylinux wheels HOT 2
- PyInstaller executable with matplotlib cannot find _cext DLL HOT 6
- `top_level.txt` include a non existing module `src`
- DLL load failed while importing _cext HOT 2
- How do we define an "objective function" and maximize or minimize it? HOT 1
- On Windows 10 LTSC, import kiwisolver (and/or import matplotlib) fails with DLL _cext even after installing VS runtime (solution incl) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kiwi.