Simplification with Power Set

106 views
Skip to first unread message

Shawn

unread,
Sep 4, 2018, 5:57:22 PM9/4/18
to AMPL Modeling Language

Greetings,

Is there an efficient way to simplify the following expression using powersets in AMPL?

Specifically, I defined one powerset for p and the other one for Qmax where p represent failure probabilities of suppliers and Qmax represent capacity (p and Qmax values are set in .dat file).

I do not know how to combine these two power sets correctly.

 

p[1]*(1-p[2])*(1-p[3])*min(D[p,t],Qmax[p,2,t]+Qmax[p,3,t])+

p[2]*(1-p[1])*(1-p[3])*min(D[p,t],Qmax[p,1,t]+Qmax[p,3,t])+

p[3]*(1-p[1])*(1-p[2])*min(D[p,t],Qmax[p,1,t]+Qmax[p,2,t])+

p[1]*p[2]*(1-p[3])*min(D[p,t],Qmax[p,3,t])+

p[1]*p[3]*(1-p[2])*min(D[p,t],Qmax[p,2,t])+

p[2]*p[3]*(1-p[1])*min(D[p,t],Qmax[p,1,t])+

p[1]*p[2]*p[3]);


Any guide is highly appreciated.

Thank you

AMPL Google Group

unread,
Sep 4, 2018, 11:23:39 PM9/4/18
to Ampl Modeling Language
I need to be clear about a couple of things before working in your problem. One thing that surprise me is Qmax[p,2,t]. You have been accessing p[1] that means p should be indexed. How are you using 'p' without any index in Qmax[p,2,t]? Can you successfully compile your code in AMPL? You said you defined power set for 'p', but you are accessing p[1]..p[3] as if 'p' is a param. Refer to following documents about how to define power set in AMPL https://ampl.com/faqs/how-can-i-get-ampl-to-index-over-the-power-set-consisting-of-all-subsets-of-a-set/. I have copied the small portion below:

param n:=3 integer > 0;
set S := 0 .. n - 1;
set SS := 0 .. 2**n - 1;
set POW {k in SS} := {i in S: (k div 2**i) mod 2 = 1};

The POW[i] corresponds to the ith set in the power set. Are you trying to create all subset of a set?

--
Dr. Paras Tiwari
am...@googlegroups.com
{#HS:656434708-22123#}
--
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+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.



Reply all
Reply to author
Forward
0 new messages