Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 03-10-2020 04:43 PM
(692 views)

This constraint forces that a DC is served by exactly "x" number of LSPs.

```
/*Constraint for retricting DC-LSP: given DC can by served by "x" number of LSPs*/
num DC_LSPs=5;
con DC_LSP: sum{c in LSP} IsLSPDC[c,'LAX'] = DC_LSPs;
con DC_LSP_Link1{p in Ports, t in Transit,c in lsp, d in {'LAX'}}:
ContainersfromPortstoLSPtoDC[p,t,c,'AL1'] <= BigM * IsLSPDC[C,'LAX'];
con DC_LSPLink2{c in LSP, d in DC}:
sum {p in Ports, t in Transit} ContainersfromPortstoLSPtoDC[p,t,c,d] >= IsLSPDC[c,d];
```

This works fine. Now I want to have another constraint where I want to follow the same logic but want to limit my choice of DC to anything that is not in ('LAX','SAV'). So am looking to write sthg like

`con DC_LSP_NoSAVLAX: sum{c in LSP} IsLSPDC[c,not in ('SAV,'LAX')] = DC_LSPs;`

Can i do that? If yes what would be the correct syntax.

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

If you really want just one constraint, here are two ways:

```
con DC_LSP_NoSAVLAX:
sum{c in LSP, d in DC: d not in {'SAV,'LAX'}} IsLSPDC[c,d] = DC_LSPs;
```

```
con DC_LSP_NoSAVLAX:
sum{c in LSP, d in DC diff {'SAV,'LAX'}} IsLSPDC[c,d] = DC_LSPs;
```

If instead you want a family of constraints indexed by d, here are two ways:

```
con DC_LSP_NoSAVLAX {d in DC: d not in {'SAV,'LAX'}}:
sum{c in LSP} IsLSPDC[c,d] = DC_LSPs;
```

```
con DC_LSP_NoSAVLAX {d in DC diff {'SAV,'LAX'}}:
sum{c in LSP} IsLSPDC[c,d] = DC_LSPs;
```

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

If you really want just one constraint, here are two ways:

```
con DC_LSP_NoSAVLAX:
sum{c in LSP, d in DC: d not in {'SAV,'LAX'}} IsLSPDC[c,d] = DC_LSPs;
```

```
con DC_LSP_NoSAVLAX:
sum{c in LSP, d in DC diff {'SAV,'LAX'}} IsLSPDC[c,d] = DC_LSPs;
```

If instead you want a family of constraints indexed by d, here are two ways:

```
con DC_LSP_NoSAVLAX {d in DC: d not in {'SAV,'LAX'}}:
sum{c in LSP} IsLSPDC[c,d] = DC_LSPs;
```

```
con DC_LSP_NoSAVLAX {d in DC diff {'SAV,'LAX'}}:
sum{c in LSP} IsLSPDC[c,d] = DC_LSPs;
```

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

the constraint worked.

I have the second constraint that I changed to this. But i get syntax errors.

con DC_LSP_Direct_Link1{p in Ports, t in Transit,c in lsp, d not in {'SAV','LAX'}}:

ContainersfromPortstoLSPtoDC[p,t,c,d not in {'SAV','LAX'}] <= BigM * IsLSPDC[c,d not in {'SAV','LAX'}];

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I think i know why . let me try the fix

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I tried this. still got error:

con DC_LSP_Direct_Link1{p in Ports, t in Transit,c in lsp, d in DC: d not in {'SAV','LAX'}}:

ContainersfromPortstoLSPtoDC[p,t,c,d in DC: d not in {'SAV','LAX'}] <= BigM * IsLSPDC[c,d in DC: d not in {'SAV','LAX'}];

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. **Registration is now open through August 30th**. Visit the SAS Hackathon homepage.

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.