# Need a Smile

## Re: Need a Smile

Because I was at work in front of students with two screens and the projector on and a failed copy/paste isn't a good idea

On the other screen it was written (and yes it makes sense to me, but not a lot to students!)

MODEL:

!Given a set of nodes and the distance between each pair, find

the shortest total distance of links on the network to connect

all the nodes. This is the classic minimal spanning tree (MST)

problem. Typical application is designing the network of

utilities in a community, e.g., sewers, power lines,

phone lines, cable TV, roads, water lines, also electric

circuit design;

SETS:

CITY: LVL;

! LVL( I) = level of city I in tree. LVL( 1) = 0;

LINK( CITY, CITY):

DIST, ! The distance matrix;

X; ! X( I,J) = 1 if we use link I, J;

IFLINK(CITY,CITY,CITY,CITY); ! Link 1,2 only if link 3,4;

ATMOST1(CITY,CITY); ! At most one of these links;

ENDSETS

! This model finds the minimum cost network connecting

a set of cities;

DATA:

CITY = A B C D E;

! Distance matrix need not be symmetric. City 1 is base;

DIST = 0 20 10 15 99 !from A;

20 0 99 99 30 !from B;

10 99 0 25 5 !from C;

15 99 25 0 40 !from D;

99 30 5 40 0;!from E;

IFLINK = A, D, D, E;

ATMOST1 = A,D C,D, A,B;

ENDDATA

!----------------------------------------------;

! Take care of special constraints;

! Link i,j only if link r,s;

@FOR( IFLINK(I,J,R,S):

X(I,J)+X(J,I) <= X(R,S)+X(S,R);

);

! At most 1 of the links in this set;

@SUM(ATMOST1(I,J): X(I,J)+X(J,I)) <= 1;

! This is a simple, small, loose formulation.

Warning, may be slow for N > 8;

N = @SIZE( CITY);

!The objective is to minimize total dist. of links;

MIN = @SUM( LINK(I,J): DIST(I,J) * X(I,J));

!For city K, except the base, ... ;

@FOR( CITY( K)| K #GT# 1: ! It must be entered;

@SUM( CITY( I)| I #NE# K: X( I, K)) = 1;

!If there is a link from J-K, then LVL(K)=LVL(J)+1.

Note:These are not very powerful for large problems;

@FOR( CITY( J)| J #NE# K:

LVL( K) >= LVL( J) + X( J, K)

- ( N - 2) * ( 1 - X( J, K))

+ ( N - 3) * X( K, J); ); );

LVL( 1) = 0; ! City 1 has level 0;

!There must be an arc out of city 1;

@SUM( CITY( J)| J #GT# 1: X( 1, J)) >= 1;

!Make the X's 0/1;

@FOR( LINK: @BIN( X); );

!The level of a city except the base is at least 1 but no more than N-1,

and is 1 if link to the base;

@FOR( CITY( K)| K #GT# 1:

@BND( 1, LVL( K), 999999);

LVL( K) <= N - 1 - ( N - 2) * X( 1, K); );

END

On the other screen it was written (and yes it makes sense to me, but not a lot to students!)

MODEL:

!Given a set of nodes and the distance between each pair, find

the shortest total distance of links on the network to connect

all the nodes. This is the classic minimal spanning tree (MST)

problem. Typical application is designing the network of

utilities in a community, e.g., sewers, power lines,

phone lines, cable TV, roads, water lines, also electric

circuit design;

SETS:

CITY: LVL;

! LVL( I) = level of city I in tree. LVL( 1) = 0;

LINK( CITY, CITY):

DIST, ! The distance matrix;

X; ! X( I,J) = 1 if we use link I, J;

IFLINK(CITY,CITY,CITY,CITY); ! Link 1,2 only if link 3,4;

ATMOST1(CITY,CITY); ! At most one of these links;

ENDSETS

! This model finds the minimum cost network connecting

a set of cities;

DATA:

CITY = A B C D E;

! Distance matrix need not be symmetric. City 1 is base;

DIST = 0 20 10 15 99 !from A;

20 0 99 99 30 !from B;

10 99 0 25 5 !from C;

15 99 25 0 40 !from D;

99 30 5 40 0;!from E;

IFLINK = A, D, D, E;

ATMOST1 = A,D C,D, A,B;

ENDDATA

!----------------------------------------------;

! Take care of special constraints;

! Link i,j only if link r,s;

@FOR( IFLINK(I,J,R,S):

X(I,J)+X(J,I) <= X(R,S)+X(S,R);

);

! At most 1 of the links in this set;

@SUM(ATMOST1(I,J): X(I,J)+X(J,I)) <= 1;

! This is a simple, small, loose formulation.

Warning, may be slow for N > 8;

N = @SIZE( CITY);

!The objective is to minimize total dist. of links;

MIN = @SUM( LINK(I,J): DIST(I,J) * X(I,J));

!For city K, except the base, ... ;

@FOR( CITY( K)| K #GT# 1: ! It must be entered;

@SUM( CITY( I)| I #NE# K: X( I, K)) = 1;

!If there is a link from J-K, then LVL(K)=LVL(J)+1.

Note:These are not very powerful for large problems;

@FOR( CITY( J)| J #NE# K:

LVL( K) >= LVL( J) + X( J, K)

- ( N - 2) * ( 1 - X( J, K))

+ ( N - 3) * X( K, J); ); );

LVL( 1) = 0; ! City 1 has level 0;

!There must be an arc out of city 1;

@SUM( CITY( J)| J #GT# 1: X( 1, J)) >= 1;

!Make the X's 0/1;

@FOR( LINK: @BIN( X); );

!The level of a city except the base is at least 1 but no more than N-1,

and is 1 if link to the base;

@FOR( CITY( K)| K #GT# 1:

@BND( 1, LVL( K), 999999);

LVL( K) <= N - 1 - ( N - 2) * X( 1, K); );

END

## Re: Need a Smile

Enlisted mother's view of officers comes through, explaining why they don't allow fraternization.

**Pokermind**- Posts : 199

Join date : 2015-07-02

Age : 65

## Re: Need a Smile

Watch out Taylor!

Photo from Taylor's Facebook page.

Photo from Taylor's Facebook page.

**Pokermind**- Posts : 199

Join date : 2015-07-02

Age : 65

## Re: Need a Smile

Kitten Warrior ready to do battle with the red dot.

**Pokermind**- Posts : 199

Join date : 2015-07-02

Age : 65

## Re: Need a Smile

Idaho humor, we had the back of Stinker Station signs, this one in a field of rounded basalt rocks (now mostly gone) brought a smile before the interstate on old US 30:

**Pokermind**- Posts : 199

Join date : 2015-07-02

Age : 65

Similar topics

» Improve your smile with porcelian veneers

» If this doesn't put a smile on your face, you're dead :)

» Conundrum about Guilt

» What is the meaning of , "smiling assassin"?

» HANDS - Osama bin Laden

» If this doesn't put a smile on your face, you're dead :)

» Conundrum about Guilt

» What is the meaning of , "smiling assassin"?

» HANDS - Osama bin Laden

Page

**1**of**1****Permissions in this forum:**

**cannot**reply to topics in this forum