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

- 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
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-12-2015 08:50 PM

Hello,

I have a silly question. However not sure if there is an answer to my silly question.

I am formulating a model where in one of the constraints, for a decision variable to be true, it depends on other decision variables.

example:

for all (<i,j,n> in MasterRoute>

if X

<= Ui <= Uj <= Udn then Y[i,j,n]=1

X, Y, U and Y are decision variables.

Accepted Solutions

Solution

02-12-2015
10:24 PM

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

Posted in reply to V12DBS

02-12-2015 10:24 PM

The proposition

if AND {j in 1..n} (P

where P

sum {j in 1..n} P

Assuming X, W, and Y are binary variables in your problem, you can express the desired proposition in this form by introducing additional binary variables (and big-M constraints) to represent each of the following three propositions:

- sum{<nod,(n)> in PickUpNode, p in PickSanity=nod and nod=1} U
<= Ui

- Ui <= Uj
- Uj <= Udn

Do you have bounds for U?

All Replies

Solution

02-12-2015
10:24 PM

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

Posted in reply to V12DBS

02-12-2015 10:24 PM

The proposition

if AND {j in 1..n} (P

where P

sum {j in 1..n} P

Assuming X, W, and Y are binary variables in your problem, you can express the desired proposition in this form by introducing additional binary variables (and big-M constraints) to represent each of the following three propositions:

- sum{<nod,(n)> in PickUpNode, p in PickSanity=nod and nod=1} U
<= Ui

- Ui <= Uj
- Uj <= Udn

Do you have bounds for U?

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

Posted in reply to RobPratt

02-12-2015 10:49 PM

Hi Rob,

Thanks for the quick reply. Infact, I have converted the above mentioned proposition into the following constraint. Please excuse my indexing technique. I used different notation for indexes as SAS kept giving me "hides outer declaration"error. My priority was to have a feasible model and then go back and have efficient coding for compression. 1000 is the Big-M and I have bounds for U. U is part of the MTZ subtour elimination. However, the solution is infeasible and I am grinding my teeth debugging the infeasibility. In the routing model that I am developing, I am have a DV "RV" that is indexed over i,j,product,size. In the model the product the truck carries are all unique from each other because the product is an automobile. I have another DV "R" indexed over i,j. While I am getting an optimal route with "R", I am not able to connect RV with R correctly.

example: Civic Medium pickup = Location A dropoff = Location C

Accord Medium pickup = Location B dropoff = Location C

When I solve the model the "R" DV will correctly traverse the arc to get an optimal route, however the "RV" DV does not. I will see RV[A,B,Civic,medium] = 1 and not RV[A,B,Civic,medium]=1 and RV[B,C,Civic,medium]=1. Have the flow balance constraint but still does not work.

Con New{<f,t,ve,si> in MasterRoute}:

RV[f,t,ve,si] >= 5 - sum{<e,z> in Vehicle:e=ve and z=si} 1 * V[e,z] - sum{<fr,to> in RouteDistance:fr=f and to=t} 1 * R[fr,to] -

sum{<node,vehi,size> in JC:node=f and vehi=ve and size=si} 1* A[node,vehi,size]

- sum{<nod,veh,siz> in JC:nod=t and veh=ve and siz=si} 1 * B[nod, veh,siz] - sum{<bh,ga> in RouteDistance:bh=f and ga=t} 1 * C[bh,ga];

con New1{<no,ve,si> in JC}:

1000 * (A[no,ve,si] - 1) <= UAll[no] - sum{<nod,veh,siz> in PickUpNode, s in PickSanity:s=nod and nod=no and veh=ve and siz=si} 1 * UAll~~;~~

con New2{<no,ve,si> in JC}:

1000 * (A[no,ve,si] - 1) >= - UAll[no] + sum{<nod,veh,siz> in PickUpNode, s in PickSanity:s=nod and nod=no and veh=ve and siz=si} 1 * UAll~~;~~

con New3{<no,ve,si> in JC}:

1000 * (B[no,ve,si] - 1) <= - UAll[no] + sum{<nod,veh,siz> in DropOffNode, s in DropSanity:s=nod and nod=no and veh=ve and siz=si} 1 * UAll~~;~~

con New4{<no,ve,si> in JC}:

1000 * (B[no,ve,si] - 1) >= UAll[no] - sum{<nod,veh,siz> in DropOffNode, s in DropSanity:s=nod and nod=no and veh=ve and siz=si} 1 * UAll~~;~~

con New5{<fr,to> in RouteDistance}:

1000 * (C[fr,to] - 1) <= UAll[to] - UAll[fr];

con New6{<fr,to> in RouteDistance}:

1000 * (C[fr,to] - 1) >= - UAll[to] + UAll[fr];

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

Posted in reply to V12DBS

02-12-2015 11:33 PM

It will help me understand better if you write the desired logical relationship among V, R, A, B, C, and RV as a proposition using IF, THEN, AND, OR, and NOT, without the indexing.

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

Posted in reply to RobPratt

02-13-2015 02:38 PM

I suspect that you want to enforce the following proposition:

if V = 1 and R = 1 and A = 1 and B = 1 and C = 1 then RV = 1

The corresponding linear constraint would be:

V + R + A + B + C - 4 <= RV

But you currently have (Con New):

V + R + A + B + C + RV >= 5

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

Posted in reply to RobPratt

02-13-2015 02:54 PM

Apologies for the delay.

V = Vehicle DV. Indexed over AutoID and Size. Type = Binary.

R = Arc DV. Indexed over I & J. Type = Binary

A = Visit Node. Indexed over I, AutoID and Size, Type = Binary

B = Visit Node. Indexed over J, AutoID and Size. Type = Binary

RV = Arc with AutoID. Indexed over I, J, AutoID and Size. Type = Binary

My main goal is to make sure that I carry my Automobile that is on a truck from it's pickup all the way to dropoff (while visiting transition nodes for other automobile pickup)

So If I select to carry(V) an Automobile and pass through an arc (R) and the arc's I th node and J th node than RV = 1.

Thanks for checking my constraint. I dont think I need the C though. However, The new2...new6 constraints that I have after the V + R + A + B + C + RV >= 5, seems to be the problem. Or probably I have something formulated in the model elsewhere that is causing the model's infeasibility.

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

Posted in reply to V12DBS

02-13-2015 03:03 PM

Then I think you want

V + R + A + B - 3 <= RV

instead of your current Con New.

If that change doesn't correct the issue, you might try fixing variables to a known feasible solution, call the solver, and see which constraints are flagged as infeasible.