{"action":"created","issue":{"url":"https://api.github.com/repos/chocoteam/choco-solver/issues/534","repository_url":"https://api.github.com/repos/chocoteam/choco-solver","labels_url":"https://api.github.com/repos/chocoteam/choco-solver/issues/534/labels{/name}","comments_url":"https://api.github.com/repos/chocoteam/choco-solver/issues/534/comments","events_url":"https://api.github.com/repos/chocoteam/choco-solver/issues/534/events","html_url":"https://github.com/chocoteam/choco-solver/issues/534","id":235852904,"number":534,"title":"Scalar Constraint leads to wrong results  ","user":{"login":"Andreeew91","id":29429370,"avatar_url":"https://avatars3.githubusercontent.com/u/29429370?v=3","gravatar_id":"","url":"https://api.github.com/users/Andreeew91","html_url":"https://github.com/Andreeew91","followers_url":"https://api.github.com/users/Andreeew91/followers","following_url":"https://api.github.com/users/Andreeew91/following{/other_user}","gists_url":"https://api.github.com/users/Andreeew91/gists{/gist_id}","starred_url":"https://api.github.com/users/Andreeew91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Andreeew91/subscriptions","organizations_url":"https://api.github.com/users/Andreeew91/orgs","repos_url":"https://api.github.com/users/Andreeew91/repos","events_url":"https://api.github.com/users/Andreeew91/events{/privacy}","received_events_url":"https://api.github.com/users/Andreeew91/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-06-14T11:49:02Z","updated_at":"2017-06-16T09:08:34Z","closed_at":null,"body":"Hi there!\r\nWhen using the scalar constraint like\r\n`model.scalar(intVarArray, COEFFS, \"=\", db).post();`\r\nThe result is leading into wrong values when I'm having the Arrays intVarArray and COEFFS with an amount of values greater than 10 values. Is anything known about this issue or can anybody help solving it?\r\nMany thanks in advance!\r\n\r\nhere's my code example:\r\n\r\n```java\r\nfinal int AMOUNT = 20;\r\n\r\nModel model = new Model(\"KEO\");\r\n\r\nint[] solving = new int[AMOUNT];\r\n\r\nIntVar[] intVarArray = new IntVar[AMOUNT];\r\n\r\nfor (int i = 0; i < AMOUNT; i++) {\r\n\tintVarArray[i] = model.intVar(\"x\" + i, 0, 440);\r\n}\r\n\r\nIntVar db = model.intVar(\"db\", -100000, 100000);\r\n\r\n// Entspraeche dem CSS\r\nint[] COEFFS = new int[AMOUNT];\r\n\r\nfor (int i = 0; i < AMOUNT; i++) {\r\n\tCOEFFS[i] = (int) (Math.random() * 100 * Math.pow(-1, i));\r\n}\r\n\r\nmodel.scalar(intVarArray, COEFFS, \"=\", db).post();\r\n\r\nmodel.setObjective(Model.MAXIMIZE, db);\r\n\r\nSolver solver = model.getSolver();\r\n\r\nint counter = 0;\r\nwhile (solver.solve()) {\r\n\tSystem.out.println(counter + \". Durchgang von solve()\");\r\n\tcounter++;\r\n\tfor (int i = 0; i < AMOUNT; i++) {\r\n\t\tsolving[i] = intVarArray[i].getValue();\r\n\t}\r\n}\r\n\r\nfor (int i = 0; i < AMOUNT; i++) {\r\n\tSystem.out.println(\"Solving: \" + solving[i] + \" CSS: \" + COEFFS[i]);\r\n}\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/chocoteam/choco-solver/issues/comments/308974855","html_url":"https://github.com/chocoteam/choco-solver/issues/534#issuecomment-308974855","issue_url":"https://api.github.com/repos/chocoteam/choco-solver/issues/534","id":308974855,"user":{"login":"cprudhom","id":1171872,"avatar_url":"https://avatars2.githubusercontent.com/u/1171872?v=3","gravatar_id":"","url":"https://api.github.com/users/cprudhom","html_url":"https://github.com/cprudhom","followers_url":"https://api.github.com/users/cprudhom/followers","following_url":"https://api.github.com/users/cprudhom/following{/other_user}","gists_url":"https://api.github.com/users/cprudhom/gists{/gist_id}","starred_url":"https://api.github.com/users/cprudhom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cprudhom/subscriptions","organizations_url":"https://api.github.com/users/cprudhom/orgs","repos_url":"https://api.github.com/users/cprudhom/repos","events_url":"https://api.github.com/users/cprudhom/events{/privacy}","received_events_url":"https://api.github.com/users/cprudhom/received_events","type":"User","site_admin":false},"created_at":"2017-06-16T09:08:34Z","updated_at":"2017-06-16T09:08:34Z","body":"I suppose that you are expecting that all variables with a negative coefficient are set to 0 which is not the case in the solution found (which maximize 'db') but since you declared too small bounds for this variable that the best solution.\r\nTry by setting the upper bound to `IntVar.MAX_INT_BOUND` and you will find \r\n`\r\nSolving: 440 CSS: 26\r\nSolving: 0 CSS: -40\r\nSolving: 440 CSS: 11\r\nSolving: 0 CSS: -36\r\nSolving: 440 CSS: 44\r\nSolving: 0 CSS: -92\r\nSolving: 440 CSS: 58\r\nSolving: 0 CSS: -13\r\nSolving: 440 CSS: 96\r\nSolving: 440 CSS: 0\r\nSolving: 440 CSS: 19\r\nSolving: 0 CSS: -78\r\nSolving: 440 CSS: 38\r\nSolving: 0 CSS: -40\r\nSolving: 440 CSS: 59\r\nSolving: 0 CSS: -92\r\nSolving: 440 CSS: 31\r\nSolving: 0 CSS: -38\r\nSolving: 440 CSS: 99\r\nSolving: 0 CSS: -81\r\n`\r\n\r\n\r\n"}}
{"actor":{"display_login":"cprudhom"}}