# Exercise 1-6 "impossible deduced bounds" presolve error

**URL:** <https://discuss.ampl.com/t/exercise-1-6-impossible-deduced-bounds-presolve-error/955>\
**Category:** Support\
**Tags:** general, errors-and-messages, modeling\
**Created:** [February 21, 2024, 7:20am UTC](https://discuss.ampl.com/t/exercise-1-6-impossible-deduced-bounds-presolve-error/955 "2024-02-21T07:20:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sridharraman](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/sridharraman/32/661_2.png) [@sridharraman](https://discuss.ampl.com/u/sridharraman)\
**Post date:** [February 21, 2024, 7:20am UTC](https://discuss.ampl.com/t/exercise-1-6-impossible-deduced-bounds-presolve-error/955/1 "2024-02-21T07:20:55Z")

</div>

Hi, I am new to AMPL and have started the AMPL handbook and just finished the first chapter: Production Models - Maximizing Profits. I was doing the exercises and was stumped when I came to the last one (1-6), i.e. the oil refining process one.

I get the following error:

```auto
presolve, variable Barrels_Product_Made['HF']:
impossible deduced bounds: lower = 3.41477, upper = 0.303303;
difference = 3.11147

presolve, variable Barrels_Product_Made['D']:
impossible deduced bounds: lower = 11.724, upper = 0.303303;
difference = 11.4207

presolve, variable Barrels_Product_Made['RG']:
impossible deduced bounds: lower = 18.3945, upper = 3.52326;
difference = 14.8712

presolve, variable Barrels_Product_Made['PG']:
impossible deduced bounds: lower = 19.1484, upper = 3.36667;
difference = 15.7817

presolve: constraint Intermediate_For_Products['B'] cannot hold:
body >= 370 cannot be <= 6.88992; difference = 363.11

```

I think it’s probably due to the way I am entering the data for Ujk, i.e. “maximum allowed units of attribute k per barrel of final product j”. In sub-section (c) of the exercise, it gives the values for the attribute limits and also says this: “Limits left blank, such as density for gasoline, are irrelevant and may be set to some relatively large number.”. I tried giving Infinity, 99999, etc. for them, but the error persists.

Any help on this would be appreciated? Thanks.

---

<div class="post-metadata">

**Author:** ![4er](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/4er/32/530_2.png) [@4er](https://discuss.ampl.com/u/4er)\
**Post date:** [February 21, 2024, 5:06pm UTC](https://discuss.ampl.com/t/exercise-1-6-impossible-deduced-bounds-presolve-error/955/2 "2024-02-21T17:06:34Z")

</div>

For the limits left blank, a large value like 99999 should work. The error might be somewhere else in the data file — can you reply with the data file attached? (Use the “Upload” icon.)

---

<div class="post-metadata">

**Author:** ![sridharraman](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/sridharraman/32/661_2.png) [@sridharraman](https://discuss.ampl.com/u/sridharraman)\
**Post date:** [February 21, 2024, 6:03pm UTC](https://discuss.ampl.com/t/exercise-1-6-impossible-deduced-bounds-presolve-error/955/3 "2024-02-21T18:03:02Z")

</div>

[exercise.1.6.c.dat](https://discuss.ampl.com/uploads/short-url/yweRzIR237DzArm2Q7BA4lR7exd.dat) (954 Bytes)  
[exercise.1.6.c.mod](https://discuss.ampl.com/uploads/short-url/zjQCiuRsuYgK0jUttbfEUksYnGg.mod) (2.8 KB)

I have uploaded both the model and data files. Also, I changed the research octane to a negative large number. But the same error persists.

---

<div class="post-metadata">

**Author:** ![4er](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/4er/32/530_2.png) [@4er](https://discuss.ampl.com/u/4er)\
**Post date:** [February 22, 2024, 10:46pm UTC](https://discuss.ampl.com/t/exercise-1-6-impossible-deduced-bounds-presolve-error/955/4 "2024-02-22T22:46:00Z")

</div>

All of the blank entries in the `max_attrib_per_product_barrel` table should be large positive numbers. You should double-check the other data as well, to be sure it all matches what’s shown in the exercise.

Also you’ll need to study the constraints to be sure they are saying what you want. AMPL’s “expand” command can be useful for examining the constraints that are being generated. For example, you have the following for constraint `Attributes_Intermediates`, which does not seem right:

```auto
ampl: expand Attributes_Intermediates;
subject to Attributes_Intermediates['PG','vap']:
	-12.2*Barrels_Product_Made['PG'] <= -233.61;

subject to Attributes_Intermediates['PG','oct']:
	90*Barrels_Product_Made['PG'] <= 303;

subject to Attributes_Intermediates['PG','den']:
	-999*Barrels_Product_Made['PG'] <= -1202;

subject to Attributes_Intermediates['PG','sul']:
	-999*Barrels_Product_Made['PG'] <= -5.862;

subject to Attributes_Intermediates['RG','vap']:
	-12.7*Barrels_Product_Made['RG'] <= -233.61;

subject to Attributes_Intermediates['RG','oct']:
	86*Barrels_Product_Made['RG'] <= 303;
.......

```

It may look strange to have, for example, `-12.2*Barrels_Product_Made['PG']` `<=` `-233.61`, but that’s just the same as `12.2*Barrels_Product_Made['PG']` `>=` `233.61`.

---

<div class="post-metadata">

**Author:** ![sridharraman](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/sridharraman/32/661_2.png) [@sridharraman](https://discuss.ampl.com/u/sridharraman)\
**Post date:** [February 26, 2024, 8:57am UTC](https://discuss.ampl.com/t/exercise-1-6-impossible-deduced-bounds-presolve-error/955/5 "2024-02-26T08:57:04Z")

</div>

Thank you so much for this! I was still in the first chapter and hadn’t come across `expand` yet.

As you rightly pointed out, there was an error in defining the last constraint. It was supposed to be `r[i, k] * X[i, j]` on the LHS. But I had forgotten to multiply the second part.

I updated the constraint now to this:

```auto
# For each product, the total attributes contributed by all intermediates must not exceed the total allowed
subject to Attributes_Intermediates {j in PRODUCT, k in ATTRIBUTE}:
    sum {i in INTERMEDIATE} attributes_per_barrel[i, k] * Barrels_Intermediate_For_Product[i, j] <= max_attrib_per_product_barrel[j, k] * Barrels_Product_Made[j];

```

On running the solver, I now get a solution:

```auto
ampl: solve;
HiGHS 1.5.3: optimal solution; objective 648385.047
6 simplex iterations
0 barrier iterations
 
ampl: display Barrels_Product_Made;
Barrels_Product_Made [*] :=
 D 2237.04
HF 34823
PG 7284.4
RG 35505.6
;

```
