Skip to content

Choice of output can make Gecode 6.3.0 nonterminate #220

@hwayne

Description

@hwayne

Model:

float: r = 0.01;
int: years = 121;
var 0.0..10000.0: c;
array[1..years] of var 0.0..20000.0: m;

constraint m[1] = c;
constraint forall(i in 2..(years)) 
 (m[i] = m[i-1]*(1+r) + c);
  
constraint m[years] >= 10000.0;
solve minimize c;
output ["\(c)\n\(c*years)\n"];

Gecode solves this model on my machine in approximately 1 second. If I make one change to the output:

- output ["\(c)\n\(c*years)\n"];

+ output ["\(c)\n\(c*years)\n\(m[years])"];

It gets the same solution in the same amount of time, and then continues running indefinitely. This seems to be sensitive to the chosen parameters. Setting years = 120 or r >= 0.3 causes the bug to disappear.

This is Version 2.9.3 (1832659182) on Windows 11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions