condition

11 views
Skip to first unread message

Rahaf

unread,
Mar 12, 2023, 5:49:24 AM3/12/23
to AMPL Modeling Language
Hello
Could someone help me to solve this issue please,

I have 7 devices, each device represents with a letter g, and the device that is neighbor to it represents with a latter gu.

Devices 1 to 4 are transmitters, devices 5 and 6 are switches, and device number 7 is controller . Device No. 1 can send to device No. 2 via device No. 5, and device No. 2 has a direct link  that it can send to device No. 3 without any switch. Device No. 3 sends to device No. 4 through device No. 6. Device No. 1 can send It is sent to device No. 4 through device No. 7. Device No. 1 and 2 are a group in the same group connect together by device no 5. And the devices.Device No. 3 and 4 are anther group in the same group connect with device NO 6

 Here is a summary of the connections between the devices:

Device 1 can send data to Device 2 through Device 5.
Device 2 can send data directly to Device 3.
Device 3 can send data to Device 4 through Device 6.
Device 1 can send data to Device 4 through Device 7.
Devices 1 and 2 are in the same group, connected by Device 5.
Devices 3 and 4 are in the same group, connected by Device 6.

There is a amount of data traffic being sent and receive between them.

in AMPL i have represents them like this:
var E{g in G,gu in GU[g]}binary;# =1 if the phat between g and neighbor gu is active otherwise = 0
paramD >=0;          #large number
param o integer > 0;
set R  within {1..o, 1..o};
param wer{R};

#dataTraffic variable has a value (Traffic Value) if there is a traffic between g and gu and otherwise (if there is no traffic between g and gu) dataOutput=0
var data_Traffic{g in G, gu in GU[g]}>=0; # amount of traffics between two devices g and gu
s.t. data_Path1 {g in G, gu in GU[g]}:data_Traffic[g,gu]<= D* E[g,gu];
s.t. data_Path2 {g in G, gu in GU[g]}:D*data_Traffic[g,gu]>=E[g,gu];
#data Path Capacity
s.t. data_Path_Capacity {g in G,gu in GU[g]}: data_Traffic[g,gu]<=E[g,gu]*wer[g,gu];


in data file I have:
param: R:
   wer
   [*,*]:
1 2 3 4 5 6 7 :=
1 . .  . . 25 .    30
2 . .  25 . 25 . .
3 . 25  . . . 25 .
4 . .  . .   . 25 30
5 25 25  .  . . . .
6 . .  25 25 . . .
7 30 .  . 30 . . . ;

The problem is that every time the model chooses to communicate only from device number two to three. Even if this  link  consume higest power consumation . I want it to choose the path that does not spend  more energy. Can someone help me formulate this condition?



Tamara Alz

unread,
Mar 13, 2023, 11:00:09 AM3/13/23
to am...@googlegroups.com

Please can someone help me:)


بتاريخ الأحد، 12 مارس 2023، جاء من Rahaf <tamara...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ampl/42842098-e40f-4d48-945d-1f780ff9d291n%40googlegroups.com.

AMPL Google Group

unread,
Mar 13, 2023, 12:34:05 PM3/13/23
to AMPL Modeling Language
I cannot reproduce the problem you are seeing, because you are not providing definitions and data for G and GU. However, I notice that your AMPL model does not have an objective function. Thus the solver will return the first solution to the constraints that it finds, and that may not be the solution that you want.

Using a "minimize" statement, you could tell AMPL to minimize an expression that represents the total power consumption. (I cannot say what that expression should be, however, since I am not familiar with the whole application. You will have to use your knowledge of the application to determine an expression for total power consumption.)


--
Robert Fourer

We're switching to a new, enhanced user forum.
Join it now at discuss.ampl.com.
{#HS:2181081585-114809#}

Rahaf

unread,
Mar 13, 2023, 1:11:24 PM3/13/23
to AMPL Modeling Language
Thank you for your answer.

set G; #Set of all Devices 
set GU{G} within G;  # Set of neighbors of all Devices g 

AMPL Google Group

unread,
Mar 14, 2023, 12:51:39 PM3/14/23
to AMPL Modeling Language
Still, it is not possible to reproduce the problem you are seeing, because you have not given any data for G or GU. To get help, it is recommended that you attach working model and data files to your reply.


--
Robert Fourer

We're switching to a new, enhanced user forum.
Join it now at discuss.ampl.com.
{#HS:2181081585-114809#}
On Mon, Mar 13, 2023 at 5:11 PM UTC, AMPL Modeling Language <am...@googlegroups.com> wrote:
Thank you for your answer.

set G; #Set of all Devices
set GU{G} within G; # Set of neighbors of all Devices g

On Mon, Mar 13, 2023 at 4:33 PM UTC, AMPL Google Group <am...@googlegroups.com> wrote:
I cannot reproduce the problem you are seeing, because you are not providing definitions and data for G and GU. However, I notice that your AMPL model does not have an objective function. Thus the solver will return the first solution to the constraints that it finds, and that may not be the solution that you want.

Using a "minimize" statement, you could tell AMPL to minimize an expression that represents the total power consumption. (I cannot say what that expression should be, however, since I am not familiar with the whole application. You will have to use your knowledge of the application to determine an expression for total power consumption.)


--
Robert Fourer

We're switching to a new, enhanced user forum.
Join it now at discuss.ampl.com.
Reply all
Reply to author
Forward
0 new messages