From: Leandro Callegari Coelho on
On Apr 27, 9:34 am, "Matt Fig" <spama...(a)yahoo.com> wrote:
> Something like this:
>
> N = 10;
>
> for jj = 2:8
>     T = nchoosek(1:N,jj);
>
>     for ii = 1:size(T,1)
>         fprintf(['x%i',repmat(' + x%i',1,size(T,2)-1),'\n'],T(ii,:))
>     end
>     fprintf('\n\n\n')
> end

Matt, thanks a lot. It works, I just need to adapt it to my equations.
I really appreciate your attention.
From: dpb on
Leandro Callegari Coelho wrote:
> On Apr 27, 9:34 am, "Matt Fig" <spama...(a)yahoo.com> wrote:
>> Something like this:
>>
>> N = 10;
>>
>> for jj = 2:8
>> T = nchoosek(1:N,jj);
....
>
> Matt, thanks a lot. It works, I just need to adapt it to my equations.
> I really appreciate your attention.

for jj = 2:8
T = nchoosek(1:N,jj);

looks somehow remarkably similar to dpb's hint to explore

for idx=1:N
nchoosek(1:N,idx)

:)

--

From: Adam Fisher on
dpb <none(a)non.net> wrote in message <hr7hat$7kd$1(a)news.eternal-september.org>...
> Leandro Callegari Coelho wrote:
> > On Apr 27, 9:34 am, "Matt Fig" <spama...(a)yahoo.com> wrote:
> >> Something like this:
> >>
> >> N = 10;
> >>
> >> for jj = 2:8
> >> T = nchoosek(1:N,jj);
> ...
> >
> > Matt, thanks a lot. It works, I just need to adapt it to my equations.
> > I really appreciate your attention.
>
> for jj = 2:8
> T = nchoosek(1:N,jj);
>
> looks somehow remarkably similar to dpb's hint to explore
>
> for idx=1:N
> nchoosek(1:N,idx)
>
> :)
>
> --
I went with
N=[1 2 3 4];
len=length(N);
for i =0:1:2^(len)-1
subset=dec2bin(i,len)=='1';
for j= N(subset)
fprintf(' + x%d ', j);
end
fprintf('=1\n');
end

if you don't want the empty set (ie =1) just switch the loop over i to start with 1
I also changed N from a struct to a vector
From: Leandro Callegari Coelho on
Guys, since you're posting here again, I'll ask your help once again.
Turns out the equation I'm trying to write is way too hard to me.

Take a look at the equation here: http://twitpic.com/1iy2bu
Using your ideas I could almost finish the left side.

Explaining from the right to the left:
Big-fancy t can be small, i.e 3
Big-fancy M is what we're using N here, so it can be something like 5.

(for the ones that are curious this equation avoids subtours on a
vehicle routing model)

Anyone with enough time to tackle this?
From: Leandro Callegari Coelho on
On Apr 27, 1:35 pm, Leandro Callegari Coelho <leandro...(a)gmail.com>
wrote:
> Guys, since you're posting here again, I'll ask your help once again.
> Turns out the equation I'm trying to write is way too hard to me.
>
> Take a look at the equation here:http://twitpic.com/1iy2bu
> Using your ideas I could almost finish the left side.
>
> Explaining from the right to the left:
> Big-fancy t can be small, i.e 3
> Big-fancy M is what we're using N here, so it can be something like 5.
>
> (for the ones that are curious this equation avoids subtours on a
> vehicle routing model)
>
> Anyone with enough time to tackle this?

bump