# A variant of the "consecutive" variables question

 2 This question is similar to the following: https://www.or-exchange.org/questions/9203/forcing-the-value-of-consecutive-variables with the following twist: I'd like for the non-zero values to be fixed at a level, but that level is a continuous variable, between defined (known) bounds. [ We have some flexibility in the number of resources we deploy out to tackle a certain job]. I'd like for the model to stay linear as much as possible, though i haven't been able to figure out how to hack the accepted answer (to the question i've linked to above) to fit my scenario. My fallback is to try a constrained "minimum variance" set of constraints, but that has multiple drawbacks: run-time for a quadratic model might be much larger the resulting profile of values is not guaranteed to be "consecutively" non-zero the resulting profile of values may not be as "brick wall" as i'd like. This complication arose in a resource scheduling scenario: the jobs (demand side) are defined in two different ways: Type 1: Job requires x hours of supply (ideally the supply profile allocated to the job should look "rectangular" or like a brick wall) spread out over a (variable) number of weeks. Type 2: Job demand in hours by week is fixed (this is the easier of the two). There is a weekly supply side constraint, which is simple. asked 04 Dec '14, 15:18 jumblees 91●1●6 accept rate: 0%

 2 A simple way is to add a binary variable xt for each of the original variables yt you have. xt = 0 iff yt = 0, and xt = 1 iff yt = z where z is the continuous variable. There are bounds on z, say l <= z <= u I would therefore state the constraints: xt = 1 implies yt = z : l . (1 - xt) <= z - yt <= u . (1 - xt) xt = 0 implies yt = 0: yt <= u . xt Then I would state the consecutive constraint on the x_t variables answered 08 Dec '14, 10:52 jfpuget 2.5k●3●10 accept rate: 8%
 toggle preview community wiki

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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: