Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Need help with Optimization Tool

rboehner79
6 - Meteoroid

I need some help with a workflow I've created around an optimization problem.  I believe the result the tool is giving me should be infeasible.  I'm enlisting the Alteryx community's help to find out what the problem is because I'm absolutely baffled.

 

The setup:

We run a distribution and marketing business distributes product across hundreds of possible truck routes depending on customer demand.  We contract with outside freight haulers to move the product and I'm building a workflow to identify the lowest cost solution for moving things.  The trucking companies that have a limited capacity to make runs and their capacity can vary by region.   

 

The constraints are set where the demand has to be met without exceeding the available carrier capacity.  I believe it's wanting to run a bunch of routes that have no demand and leaving out routes where demand exists... (see "infesasible" comments/annotations in the attached workflow).  

 

If I need to provide more context or help understanding the workflow I'll gladly do so...

 

Please help!

Stumped

10 REPLIES 10
AndrewKramer
Alteryx Alumni (Retired)

Can you re-arrange you B matrix so that your constraints are in the same order as the columns in your A matrix?

RolandSchubert
16 - Nebula
16 - Nebula

Hi @rboehner79 ,

 

interesting problem. In general, all constraints seem to be satisfied ("==" has slack 0, "<=" slack >= 0), but additional routes are added (no contraint exists), I've seen no demand condition that is not fulfilled. You could try to reorder the constraints (anchor "B") to match the column order (anchor "A") - by default, the same order is used for both, maybe this leads to confusion (even though it shouldn't). 

Did you try adding an additional condition (LocationxxxLocationyyy == 0) for the routes with no demand? 

 

Best,

 

Roland

rboehner79
6 - Meteoroid

Here is the workflow with the constraints ordered in the same way.  Interestingly it took the "infeasible" record count down from 32 to 30, but I haven't compared the solution space any closer than this.

 

I have tried setting the others routes to = 0 in a previously iteration and couldn't get it running (it would return and say there was no solution possible).  I'll try that again now that I understand the tool better and have greatly simplified the workflow.

rboehner79
6 - Meteoroid

Hi @RolandSchubert 

Thank you for that feedback.

 

It's hard to see, but even though it says "slack" is zero on those constraints... it really isn't.  A couple examples:

Product1Location340Location274 -- the constraint was for 39 loads, but only 25 were in the solution.

Product1Location145Location882 -- the constraint was for 78 loads, but only 1 was in the solution

Product1Location374Location950 -- the constraint was for 26 loads, but the solution had 94.

Those are examples -- in addition to the infeasible ones highlighted in the workflow -- that the solution space just isn't giving a right answer.  Am I missing something?

 

I tried setting a constraint to force one route's demand to be zero and it did help -- but surely that's not necessary as the above constraints aren't really being met either?

rboehner79
6 - Meteoroid

I've updated the workflow (below and in the original post) to categorize the solution results

- Valid routes; demand is met.  Only 495 of the 2049 loads fall into this category

- Valid routes; demand is NOT met.  1063 deliveries fall into this group... (the 3 examples above fall into this bucket)

- Invalid routes.  491 deliveries fall into this category

RolandSchubert
16 - Nebula
16 - Nebula

Hi @rboehner79 ,

 

I've tried to remove all capacity related constraints (row 1-73) - thus, given unlimited capacity, demand should be satisfied. Unfortunately, this also didn't work, there is still open demand and a list of routes, where no demand exists. 

I would suggest to reduce the model (i.e. starting with a simplified model) and increase the number of routes based on that. What do you think?

 

Best,

 

Roland

rboehner79
6 - Meteoroid

Here's a version with the inputs greatly simplified -- with only 6 routes and 6 carrier constraints.  The same phenomenon is still happening.

RolandSchubert
16 - Nebula
16 - Nebula

Hi @rboehner79 ,

 

hard to believe, but the solution seems to be so simple ... I reordered the variables provided to both "O" and "A" anchor and the invalid solutions are gone. Obviously, variables must be delivered in the same order, if you are using "Dense matrix, variables in rows" ... 

 

Hope the solution works for you as well.

 

Best,

 

Roland

rboehner79
6 - Meteoroid

Oh my gosh that's frustratingly simple.  I agree I got the same results in each of the workflows I have.  I'll look a little closer to make sure, but that does seem to have solved it.

 

That's a small detail that would be incredibly helpful in the Tool Mastery documentation.

Labels