BookmarkSubscribeRSS Feed
sasthepower
Calcite | Level 5

I am trying to solve a Optimization problem, but having difficulty in building a complex constraint. I am trying to assign "House" (p0-p9) to "Stores". The usual constraint of Assignment problem remains the same.


      num n = 10;

      set NSET = {1..n};

      num d {NSET, NSET};        /* Distance Matrix */
      num t {NSET, NSET};          /* Price Matrix */

      min z = sum{i in NSET, j in NSET} d[i,j] * x[i,j];        /* Minimize overall distance */

      con assign_i{i in NSET}: sum{j in NSET} x[i,j] = 1;

      con assign_j{j in NSET}: sum{i in NSET} x[i,j] = 1;

in addition I want to place a constraint based on Price. Its going to be standard deviation of PRICE of house-store pair to be less than a threshold (0.2)

I have attached an excel sheet with Distance table and Price Table.

Let me know if you need further clarifications.

1 REPLY 1
Philipp_SAS
SAS Employee

Hi,

As I understand it you can compute the standard diviation of PRICE for all pairs before creating your model and then just have a simple constraint that says

deviation*binaryvariableforpair <= threshold

But since this just excludes certain pairs, I think you can just preprocess the pairs and only include the pairs which are below the threshold in your model, which is much more efficient. The best way to do this is probably to have a "set of pairs" and only add those pairs for which your condition is not violated.

Hope this helps

Philipp

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Discussion stats
  • 1 reply
  • 837 views
  • 0 likes
  • 2 in conversation