SAS Optimization, and SAS Simulation Studio

turn on suggestions

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

Showing results for

Find a Community

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-05-2016 11:42 AM

Hi,

In my optmodel, I have a binary variable which is defined on a set with 3 elements(c,d,v) as: P{c,d,v}

I have another continous variable as x{c,d,v1,v2} which gives me 1 if P{c,d,v1}=1 and P{c,d,v2}=1 and 0 if one of them not , I defined it as

con variable_3{<c,d,v1,v2> in set3}:

x[c,d,v1,v2] = P[c,d,v1]*P[c,d,v2]

What I did is: I built a big table which has all the combination of v1 and v2 as set3, this makes my problem huge and out of memory. I was wondering about these questions:

1. Does it make a difference if I use impvar instead of the constraint for the memory issue

2. I suspect that we can define set3 directly in the opmodel as a product of two other sets without generating a big table as a combination of v1 and v2. Can somebody help me if there is a way to do that.

Thank you so much!

Accepted Solutions

Solution

12-05-2016
12:23 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Afdoone

12-05-2016 11:56 AM

All Replies

Solution

12-05-2016
12:23 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Afdoone

12-05-2016 11:56 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to RobPratt

12-05-2016 12:19 PM

Thank you! It was a very good example. The only question I have is this:

In this example variables assign is binary :

var Assign {DEPTS, CITIES} binary;

and variable product is defined as binary too

var Product {IJKL} binary;

con Product_def {<i,j,k,l> in IJKL}: Assign[i,j] + Assign[k,l] - 1 <= Product[i,j,k,l];

con Product_def2 {<i,j,k,l> in IJKL}: Product[i,j,k,l] <= Assign[i,j];

con Product_def3 {<i,j,k,l> in IJKL}: Product[i,j,k,l] <= Assign[k,l];

I think we dont need to define "product" as binary since based on the constraint I see here it automaticlly gets 1 and zero, is this correct?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Afdoone

12-05-2016 12:27 PM

Glad to help.

Yes, you can relax the new variable, and this idea is mentioned in the doc example:

"In both formulations, the `Product`

variable can be relaxed to be nonnegative instead of binary. The integrality of `Assign`

, together with the various Product_def* constraints, automatically implies integrality of `Product`

. For real-world problems, you should try both ways to determine which alternative performs better in specific cases."

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to RobPratt

12-05-2016 12:29 PM

Perfect! Thank you so much!