naming a variable starting with a '+' crashes all MiniZinc's subsolvers
See original GitHub issueSolver: all Minizinc’s subsolvers CPMpy: version v0.9.9 commit e79b3afedc934a9437c2ddb3a9f54d7e2d7bd3ee minizinc-python release version 0.7.0 commit {https://github.com/MiniZinc/minizinc-python/commit/a195cf63fcfbc98665d70ab64efb5424db25bd7e)
This one was a fun one to find, I made a typo when naming a variable and the MiniZinc subsolvers crashed. It works with other symbols as well, I tried -, #, %, * and more. It does not occur with ‘ortools’ or ‘gurobi’.
from cpmpy import *
b = boolvar(name="+")
m = Model()
m += b==0
m.solve(solver="minizinc:ortools")
expected behavior: Treat the variable name as a name instead of code.
Bug found while working on my master thesis.
Issue Analytics
- State:
- Created 10 months ago
- Comments:5
Top Results From Across the Web
Issues · CPMpy/cpmpy - GitHub
naming a variable starting with a '+' crashes all MiniZinc's subsolvers bug ... from_file seems to create two separate references for the same...
Read more >Crashes while renaming variables - Forum - Jamovi
I have downloaded XLSX files from Google Forms. These files have some variable names containing the square bracket ([]) symbol.
Read more >GENERATE_SCRIPT_VARS with Variables names that are ...
When GENERATE_SCRIPT_VARS is used on VARA key field that exceeds 32 characters and the underlying AE database is Oracle, the WP crash.
Read more >Variable Names - IBM
Observe the following rules when establishing variable names or referring to variables by their names on commands: Each variable name must be unique; ......
Read more >language agnostic - How to name variables - Stack Overflow
In practice, I don't need to spend much energy figuring out variable names. I put all of that cognitive effort into naming types,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So we decided not to clean the variables because this can lead to duplicate names (for example ‘6var’ and ‘5var’ would both be cleaned to var because names cannot start with a number)
However this can still occur for names with any of the following characters: ‘,’ ’ ’ ‘.’ ‘[’ and ‘]’ (not much we can do about that because these get introduced with np arrays)
@tias Already had a bit of code in there that cleaned the variable name from some illegal characters (but only a handful of them).
Do you think it’s best to clean all possible variable names, or to throw an exception saying which names are allowed?