# Unexpected results

**URL:** https://discuss.ampl.com/t/unexpected-results/1206
**Category:** Support
**Created:** [September 10, 2024, 1:30am UTC](https://discuss.ampl.com/t/unexpected-results/1206 "2024-09-10T01:30:34Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jesus\_Mesa](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/jesus_mesa/32/834_2.png) [@jesus\_Mesa](https://discuss.ampl.com/u/jesus_Mesa)
#### Post date: [September 10, 2024, 1:30am UTC](https://discuss.ampl.com/t/unexpected-results/1206/1 "2024-09-10T01:30:35Z")

</div>

I have the next model:

#Conjuntos  
set PL;  
set CD;  
set ZC;  
set PROD;  
set PERIODO;

#parámetros  
param WACC \>=0;  
param PRICE {PROD,ZC,PERIODO}\>=0;  
param PRCOST {PROD,PL,PERIODO}\>=0;  
param FLTPCD {PROD,PL,CD,PERIODO} \>=0;  
param FLTCDZC {PROD,CD,ZC,PERIODO} \>=0;  
param OPCOSTP {PL,PERIODO} \>=0;  
param OPCOSTCD {CD,PERIODO} \>=0;  
param TD\>=0;  
param INVP {PL,PERIODO}\>=0;  
param INVCD {CD,PERIODO}\>=0;  
param TAX {PERIODO}\>=0;  
param DEMANDA {PROD,ZC,PERIODO}\>=0;  
param CAPP {PL} \>=0;  
param CAPCD {CD} \>=0;  
param tasa{PERIODO}\>=0;

#variables  
var ingresos {t in PERIODO} \>=0;  
var totalcost {t in PERIODO} \>=0;  
var depreciacion {t in PERIODO}\>=0;  
var prcost {t in PERIODO}\>=0;  
var trcost {t in PERIODO} \>=0;  
var opcost {t in PERIODO}\>=0;  
var ppe {t in PERIODO}\>=0;  
var fai {t in PERIODO}\>=0;  
var pcdflow {p in PROD, i in PL, j in CD, t in PERIODO} \>=0;  
var cdzcflow {p in PROD, j in CD, k in ZC, t in PERIODO}\>=0;  
var w {i in PL, t in PERIODO} binary;  
var x {j in CD, t in PERIODO} binary;

var UtilOperat \>=0;  
var Utiliddw{t in PERIODO} \>= 0;

#función objetivo  
maximize Descontado:  
sum{t in PERIODO}((ingresos[t]-totalcost[t])/tasa[t]);

subject to calculo\_ingresos {t in PERIODO}:  
ingresos[t] = sum{p in PROD, j in CD, k in ZC}cdzcflow[p,j,k,t]\*PRICE[p,k,t];

subject to utilidad\_operativa:  
UtilOperat = sum{t in PERIODO}(ingresos[t]-totalcost[t]);

#################################################  
subject to calculomes {t in PERIODO}:  
Utiliddw[t] = (ingresos[t]-totalcost[t]);  
###################################################

subject to calculo\_prcost {t in PERIODO}:  
prcost[t] = sum {p in PROD, i in PL, j in CD} pcdflow[p,i,j,t]\*PRCOST[p,i,t];

subject to calculo\_trcost{t in PERIODO}:  
trcost[t] = sum {p in PROD, i in PL, j in CD}(pcdflow[p,i,j,t]\*FLTPCD[p,i,j,t]) + sum{p in PROD, j in CD, k in ZC}(cdzcflow[p,j,k,t]\*FLTCDZC[p,j,k,t]);

subject to calculo\_opcost{t in PERIODO}:  
opcost[t] = sum {i in PL} (OPCOSTP[i,t]\*w[i,t]) + sum {j in CD}(OPCOSTCD[j,t]\*x[j,t]);

subject to calculo\_totalcost {t in PERIODO}:  
totalcost[t] = opcost[t] + trcost [t]+ prcost[t];

subject to depreciacion\_ini:  
depreciacion[1]=0;

subject to calculo\_depreciacion {t in PERIODO: t\>1 }:  
depreciacion[t] = ppe[t-1]\*TD;

subject to ppe\_ini:  
ppe[1]=fai[1];

subject to calculo\_ppe {t in PERIODO: t\>1}:  
ppe[t] = ppe[t-1] + fai[t];

subject to fai\_ini:  
fai[1]= sum {i in PL}(INVP[i,1]\*w[i,1]) + sum{j in CD} (INVCD[j,1]\*x[j,1]);

subject to calculo\_fai { t in PERIODO: t\>1}:  
fai[t]= sum {i in PL}( INVP[i,t]_(w[i,t]-w[i,t-1]) ) + sum{j in CD} ( INVCD[j,t]_(x[j,t]-x[j,t-1]) );

subject to cappl {i in PL, t in PERIODO}:  
sum {p in PROD, j in CD} pcdflow [p,i,j,t] \<= CAPP[i]\*w[i,t];

subject to capcd {j in CD, t in PERIODO}:  
sum {p in PROD, i in PL} pcdflow [p,i,j,t] \<= CAPCD[j]\*x[j,t];

subject to demanda {p in PROD, k in ZC, t in PERIODO}:  
sum {j in CD} cdzcflow[p,j,k,t] = DEMANDA[p,k,t];

subject to balance {p in PROD,j in CD, t in PERIODO}:  
sum { i in PL} pcdflow[p,i,j,t] = sum { k in ZC} cdzcflow[p,j,k,t];

subject to cd\_abierta {j in CD, t in PERIODO: t\>1}:#si el CD abre se mantiene abierto  
x[j,t-1] \<= x[j,t];

subject to pl\_abierta {i in PL, t in PERIODO: t\>1}:#Si la planta abre se mantiene abierta  
w[i,t-1] \<= w[i,t];

#subject to num\_bodegas {t in PERIODO}:  
#sum {j in CD} x[j,t] = 2;

When I print the results the following appears:  
ingresos [\*] :=  
1 1000000000.0  
2 1000000000.0  
3 2000000000.0  
;

totalcost [\*] :=  
1 1000000000.0  
2 1000000000.0  
3 1000000000.0  
;

Utiliddw [\*] :=  
1 200000000.0  
2 200000000.0  
3 200000000.0  
;

Why does Utiliddw show a value of 200000000.0 when it should show the result of 1000000000.0-1000000000.0 = 0. I greatly appreciate any help you can give me.

---

<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: [September 10, 2024, 10:31pm UTC](https://discuss.ampl.com/t/unexpected-results/1206/2 "2024-09-10T22:31:20Z")

</div>

Given only the model, it is hard to know. Can you give some more information?

1. Display the values instead with these commands, and paste the result into your reply:

```auto
option display_precision 0;
option display_round '';
display ingresos, totalcost, Utiliddw;

```

1. Copy all of the output from the solver, and paste it into your reply.

2. If possible, provide the data for your problem. (You can upload a file of data by using the “upload” icon at the top of the Discourse editor window.)

---

<div class="post-metadata">

### Author: ![jesus\_Mesa](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/jesus_mesa/32/834_2.png) [@jesus\_Mesa](https://discuss.ampl.com/u/jesus_Mesa)
#### Post date: [September 10, 2024, 10:48pm UTC](https://discuss.ampl.com/t/unexpected-results/1206/3 "2024-09-10T22:48:38Z")

</div>

I appreciate your response. This morning, I couldn’t believe it when I found out it was a typographical error in `option display_precision 0;`, which I had written as `option display_precision 1`, and the calculations sent by the solver only contained one significant figure. By setting it to ‘0’, the problem was solved.

Once again, thank you very much, and I apologize for my rookie mistake.
