Hi I’m with a problem, I don’t know how to declare an equation to calculate the cost.
I have to find a diameter, this diameter have a cost
exemple:
SET
d /d1*d7 /;
nn /n1.n2, n1.n3, n3.n1, n3.n2/;
PARAMETERS
dc(d) diam. comercial (m)
/ d1 0.100
d2 0.150
d3 0.200
d4 0.250
d5 0.300
d6 0.350
d7 0.400 /
pd(d) cost of each diam.
/ d1 1.000
d2 3.000
d3 9.000
d4 11.00
d5 13.00
d6 19.00
d7 21.00 /
I tried this equations.
Variables: b (binary), X (find the diameter), costtub (find the cost), L (length), cost (OF)
*Finde one diameter of PARAMETERS
Equation1(nn).. X(nn)=e=sum(d,dc(d)*b(d,nn));
Equation2(nn).. costtub(nn)=e=L(nn)*sum(d,pd(d)*b(d,nn));
OF.. cost =e= sum(nn ,costtub(nn));
Equation 1 is not working well, at least it brings a result, however Equation 2 returns zero.
I have equations and inequations to define the diameters, and my Objective function is the cost, that I want to minimize the cost.
My OF is right? Should I minimize the sum of COSTTUB and the X (Diameter)?
Some one have any idea why my equation is not working? and how I should sove this problem?
Some of the results
X(n1,n2)
(.LO, .L, .UP = 0.1, 0.1, 0.4)
1 Equation1(n1,n2)
(0) Equation2(n1,n2)
---- VAR X diam. (m)
LOWER LEVEL UPPER MARGINAL
n1.n2 0.100 0.133 0.400 .
n1.n3 0.100 0.225 0.400 .
n3.n1 0.100 0.275 0.400 .
n3.n2 0.100 0.112 0.400 .
---- VAR ,costtub ($)
LOWER LEVEL UPPER MARGINAL
n1.n2 -INF . +INF .
n1.n3 -INF . +INF .
n3.n1 -INF . +INF .
n3.n2 -INF . +INF .
,
The LOG
Node Act. Lev. Objective IInf Best Int. Best Bound Gap (3 secs)
200 6 4 0.0000 9 - 0.0000 -
201 5 5 infeasible - - 0.0000 -
202 4 5 infeasible - - 0.0000 -
203 3 5 infeasible - - 0.0000 -
204 2 5 infeasible - - 0.0000 -
205 3 4 0.0000 12 - 0.0000 -
206 4 4 0.0000 9 - 0.0000 -
207 3 5 infeasible - - 0.0000 -
208 2 5 infeasible - - 0.0000 -
209 1 5 infeasible - - 0.0000 -
210 0 5 infeasible - - - -
Integer infeasible
Statistics:
Iterations : 3848
NLP Seconds : 2.863281
B&B nodes : 210
MIP solution : -
Best possible : -
Absolute gap : - optca : 0.000000
Relative gap : - optcr : 0.100000
Model Status : 10
Solver Status : 1
NLP Solver Statistics
Total Number of NLP solves : 212
Total Number of NLP failures: 0
Details: conopt
# execs 212
# failures 0
Terminating.
***
*** Status: Normal completion
I may be wrong, but I have the intuition that equation 2 is not being able to define the cost of the diameter
Thanks