Ceiling Function for Decision Variable or Alternative Solution

182 views
Skip to first unread message

Usman_mscse1

unread,
Nov 26, 2010, 2:06:21 AM11/26/10
to AMPL Modeling Language
Hi All,

Hope you are fine. Following is my question

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 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.

Thanks...

regards,

Novice....

Paul

unread,
Nov 26, 2010, 3:08:23 PM11/26/10
to AMPL Modeling Language
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

Usman_mscse1

unread,
Nov 26, 2010, 9:41:16 PM11/26/10
to AMPL Modeling Language
Thank you very much Paul. I will try your suggested thing and other
options.
Reply all
Reply to author
Forward
0 new messages