Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
856 views
in Technique[技术] by (71.8m points)

or tools - Possible integer overflow in constraint: linear

Dears, I'm using CP-SAT in python. I have two variables:

pippo = model.NewIntVar(-93372036854775808,9123372036854775807, 'pippo')
test = model.NewIntVar(-93372036854775808,9123372036854775807, 'test')

and the following decision variables:

for r in self.all_records:
            memory = {}
            for p in self.all_decisions:
                # create bool decision variables
                memory[p] = model.NewBoolVar('c' + str(r) + self.scenario.decisions[p].name)
            self.decision_var[r] = memory

I have two constraints:

1) test==sum(self.scenario.dataset['is_fraud'][r]*self.decision_var[r][0] for r in self.all_records)

2) pippo == test


                                                                  

If I remove constraint 2) everything is ok, but with constraint 2 I get this error:

Possible integer overflow in constraint: linear {
  vars: 126660
  vars: 126661
  coeffs: -1
  coeffs: 1
  domain: 0
  domain: 0
}
and Status is MODEL_INVALID.

I really do not understand why. Could you help me please?

question from:https://stackoverflow.com/questions/65887660/possible-integer-overflow-in-constraint-linear

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The solver pro-actively checks for possible overflow. If the model has a potential integer overflow, it is deemed invalid.

You are seeing this message. Please reduce the bounds of the integer variables (int32 min/max is most likely enough).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...