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 12-05-2016 11:42 AM
(1095 views)

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!

1 ACCEPTED SOLUTION

Accepted Solutions

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

4 REPLIES 4

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

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

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
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Perfect! Thank you so much!

Are you ready for the spotlight? We're accepting content ideas for **SAS Innovate 2025** to be held May 6-9 in Orlando, FL. The call is **open **until September 25. Read more here about **why** you should contribute and **what is in it** for you!

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.