« Return to Thread: [AMPL 2622] Help with a constraint!

[AMPL 2623] Re: Help with a constraint!

by Paul A. Rubin :: Rate this Message:

Reply to Author | View in Thread


I'm not entirely sure I understand this, but if you are saying that
you want to fix DEMANDS_pd at zero for all cells not covered by the
other two constraints, what about the following?

subject to fix_zero {i in NODES, j in NODES, k in NODES, m in NODES :
m <> i || (k <> i && k <> j)}:
DEMANDS_pd[i,j,k,m] = 0;

On Jul 2, 7:11 am, plozmar <lozano_pal...@...> wrote:

> Hi,
>
> I have a big problem trying to find a good constraint for the
> following case:
>
> ---------------------------------------
> param DEMANDS{NODES};
>
> var DEMANDS_pd {NODES, NODES, NODES, NODES};
>
> subject to demands_per_node_per_demand {i in NODES, j in NODES}:
>
>         DEMANDS_pd [i,j,j,i] = DEMANDS [i,j];
>
> subject to demands_per_node_per_demand_2 {i in NODES, j in NODES}:
>
>         DEMANDS_pd [i,j,i,i] = -DEMANDS[i,j];
> -------------------------------------------
>
> The result variable DEMANDS_pd has the following apparence,  for
> example, for  DEMANDS_pd[1,2,*,*]
>
>     1       2  3  4
> 1   0.5   0  0  0
> 2  -0.5   0  0  0
> 3   0     0  0  0
> 4   0    0  0  0
>
> this table MUST have only two elements different from zero (the same
> but opposite). I need a constraint that fixes the values of all the
> elements a zero because with another contraints, the values can
> change, and change all the result...
>
> Thank you very much in advance,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to ampl@...
To unsubscribe from this group, send email to ampl+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---

 « Return to Thread: [AMPL 2622] Help with a constraint!