We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Optimization tool configuration using Sparse (SLAM) Matrix

allienguy3n
5 - Atom

Hi everyone! I’m building a workflow in Alteryx Designer to optimize the way we assign our internal maintenance technicians to our stores.

  • Each technician can cover up to a certain maximum number of stores (capacity constraint)

  • Each store can be covered by at most one technician

  • Stage A: Maximize total coverage (assign as many stores as possible under those constraints)

  • Stage B: Given that maximum coverage level, minimize total driving miles

Setting up a classic two-stage assignment problem (maximum coverage, then minimum cost/distance to travel for tech.)


What I’ve Done

  1. Prepared input data

    • A “Pairs” table listing every valid (Technician, Store) combination and its distance in miles.

    • A “Technician” table with maximum stores per tech.

    • A “Store” table with unique store IDs.

  2. Optimization tool setup

    • Using the Optimization (Prescriptive) tool in Designer, configured in “Sparse (SLAM) matrix” mode.

       
      Optimization tool error.png

       

    • Inputs wired:

      • O input (variables): each technician–store pair, with bounds 0–1 and type = Binary (B.)

        allienguy3n_1-1755718227076.png

         

      • A input (coefficient matrix): coefficient values indicating how variables appear in each constraint.

      • allienguy3n_3-1755718306996.png

         

      • B input (constraint metadata): one row per constraint, with constraint, dir, and rhs.

        allienguy3n_2-1755718271899.png

         

         

         

  3. Constraints modeled

    • Capacity: sum of a technician’s assignments ≤ MaxStores.

    • Store coverage: sum of assignments to a store ≤ 1.


The Issue

  • Looks like I can only “map” fields in the O input, not A or B. (This matches the documentation I've found for the tool, which says A and B rely on exact field names.)

  • I've tried both sense and dir as the column for constraint direction in B, with values like “<=”.

  • Every time I run, I get an error from the Optimization tool that the input tables are not recognized properly. The tool seems unable to parse the B (constraint metadata) or A (matrix) streams even though the field names match the documentation (i, j, v for A and constraint, dir, rhs for B).

  • Even after renaming everything exactly as the Help page specifies, the error persists. I'm stumped and my team as well!


Troubleshooting Completed

  • Re-checking anchor wiring (O → variables, A → coefficients, B → constraints).

  • Rebuilding the constraint metadata with clean dir values (<=, >=, =).

  • Using “dir” instead of “sense” per the documentation.

  • Confirmed all numeric fields are truly numeric.

Despite this, the Optimization tool continues to reject the inputs... giving the same error:

allienguy3n_0-1755717958878.png

 


Question

Has anyone successfully configured the Optimization tool in SLAM matrix form for a mixed integer program?

  • Are there hidden formatting rules for the dir column (like case sensitivity, symbols v. words)?

  • Do the field names in A and B have to be exact (e.g., lowercase i, j, v), or are there mapping options I'm missing?

  • Are there any tricks for debugging when the tool won’t recognize the A or B input streams?

1 REPLY 1
KGT
13 - Pulsar

It's been a long time, so I'm not going to claim to be able to give a solution. Especially not without the actual data (not asking for it, as that's a lot of time investment). I will provide some information that may help you focus the troubleshooting. The slightest mistake can fail the whole process, and error reporting is lax with so many variables.

 

SLAM matrix will require 3 fields only, i, j, v and all numeric. i & j will refer to row, column positions Matrix. With the below, this means when converting from your screenshot on the A Input, to a SLAM/Sparse matrix, the slightest error could cause the whole thing to fail (if sorting occurs etc). I believe that if SLAM is selected, then the algorithm will convert the SLAM matrix and insert zeros for the missing values. Check out the attached from the Tool Mastery (Here) regarding SLAM.

 

Take a look at the workflow posted on the first answer here for an example of QP. In general Dense Matrix is used in examples rather than SLAM as it's a lot easier to understand, and I would try getting it going with that first.

 

Also take a look at the sample under Help > Sample Workflows > Predictive Tool Samples > Prescriptive... > 1 Model Input Modes if you haven't seen it yet.

 

When those matrices are interpreted in the optimisation tool, the constraint selections are all just read in, (for instance: constraintMode = dropdownInput('%Question.constraintMode%', 'slam') and then converted to JSON and added to the payload with the Inputs, no alignment. The payload is then handled entirely by the R function AlteryxSolve.

  • This makes them very susceptible to naming & datatype issues including case.
Labels
Top Solution Authors