On Nov 26, 2:06 am, Usman_mscse1 <
musarwa...@gmail.com> wrote:
>
> ampl: expand MultiplePath;
> subject to MultiplePath[1,13]:
> ceil(df[1,13,1]) + ceil(df[1,13,2]) <= 2;
>
> Above is the output of the expand command the value of variable df (my
> decision variable) is between 0 and 1. Ceil function does not work
The ceiling function is nonlinear (so it cannot be used in an LP or
MILP) and discontinuous (so you really do not want to use it in an
NLP).
> and
> i want to count all df variables which are greater than zero so than i
> can restrict to choose only two paths. Any alternative solution will
> also be appreciated.
1. Declare a set of binary variables (z) with the same index sets as
df.
2. Add constraints of the form df[i,j,k] <= M*z[i,j,k] for all
<i,j,k>, where M is an adequately large parameter (an a priori upper
bound on the flows along the paths, if df represents flows). You want
the upper bounds as tight as possible, so you might want to index M as
M[i,j,k] and customize the value of M for each <i,j,k>.
3. Add constraints of the form sum {k in K} z[i,j,k] <= 2.
/Paul