# Modelling an integer constraint

 0 Hello I need to construct an integer constrain for a situation that if result of an equation is positive it changed to zero and if the result of an equation is not positive it changed to a big number. For example if A-B>=0 Integer constrain=0 and if A-B<0 Integer constrain=big number. Please help me. Tanks asked 23 Dec '14, 10:23 majid 1●1●2 accept rate: 0%

2 Answers:
 2 A - B >= - M1 * Z # M1 constant, > max |A - B| A - B <= -eps + M1 * (1 - Z) # eps constant, 0 < eps << 1 == M2 * Z # M2 = big number ...or, perhaps: >= M2 * Z Z binary  answered 23 Dec '14, 16:44 fbahr ♦ 4.6k●7●16 accept rate: 13%
 0 Have you considered other modeling options? Perhaps using a binary decision variable that states if your expression in positive-valued, otherwise 0? This d-var can be implemented in the objective function easily, if that's where the 0/M are supposed to go... answered 28 Dec '14, 11:22 Gunther77 11●1 accept rate: 0%
Your answer
 toggle preview community wiki

### Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• link:[text](http://url.com/ "Title")
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

Tags:

×231
×11
×4

Asked: 23 Dec '14, 10:23

Seen: 776 times

Last updated: 28 Dec '14, 11:22

### Related questions

OR-Exchange! Your site for questions, answers, and announcements about operations research.