Closed Qix- closed 1 year ago
The problem seems to be that your problem class doesn't declare the variables that will be used as output. Adding output_vars(rows[i]);
in the for-loop that creates your variables seems to fix the problem.
The output variables are guaranteed to be set to the correct values whenever the search finds a solution. (Other variables might disappear if a better representation, like a boolean formula is available)
Ahhhh okay. That makes sense. Is this documented anywhere?
To be perfectly honest, chuffed is really not meant to be used as a library: various parts of the engine are kept in the global space and there is no documentation other than some comment in the code. We mainly maintain the FlatZinc interface.
If you are using chuffed as a library you will probably run into various issues that are not easy to resolve, and there is only limited support that we can provide.
That's disappointing mainly because it's one of the only complete FDCS implementations that is efficient and has any sort of sensible API outside of scripting languages. :/
Know of any others?
Jip's statement is a little bit too strong. We have a ToDo list for Chuffed, which also includes to make Chuffed usable as a library. However, we do not have the manpower to work on it at the moment and in the near future. But we are more than happy if you want to contribute to Chuffed by making Chuffed usable as a library.
I'm evaluating chuffed and implementing a rudimentary (and most likely very poorly performing) Sudoku solver.
Throw this into the examples folder and compile it like any other example:
It correctly solves the first two:
but chokes on the third one:
What exactly isn't supported? Looks like not declaring output variables but I'm not entirely sure what those are in terms of chuffed.