The expression that follows "obj" should be the coefficient of the arc variable (c[u,v] in this case), not the whole linear term (c[u,v]*x[u,v] as you have written).
The expression that follows "net_in =" should be the difference between the flow in and the flow out, not the whole expression for the flow in minus the flow out (as you have written). If flow in equals flow out, net_in should = 0.
Bob Fourer
From: am...@googlegroups.com [mailto:am...@googlegroups.com]
On Behalf Of Miriam
Sent: Tuesday, December 18, 2012 11:34 AM
To: am...@googlegroups.com
Subject: [AMPL 6411] model with node and arc
Hey everyone,
i have a question concerning a model with node and arc.
our task is to change a normal model into a model with node and arc.
the origin model looks like this:
param T integer;
set V:= 1..T+1;
set E:= {u in V, v in V:u<v};
param d{u in V}>=0;
param s;
param h;
param c{(u,v) in E}:= s + h* sum{j in u+1..v} ((j-u-1) * d[j-1]);
var x{(u,v) in E} binary;
minimize Kosten: sum{(u,v) in E} c[u,v] * x[u,v];
subject to Flusserhaltung{v in 2..T-1}: sum{(u,v) in E} x[u,v] = sum{(v,w) in E} x[v,w];
subject to Start: sum{(1,v) in E} x[1,v] = 1;
subject to Ende: sum{(v,5) in E} x[v,5] = 1;
i know that the expressions like param and set stay the same in model with node and arc.
the only changes are in var, minimize and subject to
my try to create a new model looks like this:
minimize Total_Kosten;
arc x{(u,v) in E} binary,obj Total_Kosten c[u,v] * x[u,v];
node Flusserhaltung{v in 2..T}: net_in= sum{(u,v) in E} x[u,v] - sum{(v,w) in E} x[v,w];
node Start: net_in = 1;
node Ende: net_out = 1;
but it doesn´t work.
can somebody help me?
kind regards
Miriam
P.S. sorry for my english
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ampl/-/IErlG_UeTrwJ.
To post to this group, send email to am...@googlegroups.com.
To unsubscribe from this group, send email to ampl+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ampl?hl=en.