r/optimization • • Sep 15 '21

Deploying Optimization Models

0 Upvotes

MOS facilitates the deployment, integration, management and utilization of mathematical optimization models. If anybody is interested in learning more or providing any feedback, would be delighted to chat, or read any comments here. Thanks

https://fuinn.ie/mos/


r/optimization • • Jul 18 '26

New optimizer

2 Upvotes

Diabolical new optimizer for neural nets https://github.com/inikishev/torchalgos

It's outperforming all other optimizers by a little, but I only tested on very small models (MLP, RNN and ConvNet), anything larger would just take ages to test all optimizers on.

Here is what it does.

  1. projects gradients to shampoo's eigenbasis;

  2. updates EMA of projected gradients;

  3. takes that EMA, clips magnitudes to (0.01, 10), and takes their reciprocals;

  4. unprojects resulting update;

  5. tracks EMA of resulting updates, the update is grafted to that EMA for stability. This prevents the update from changing norm quickly.

  6. tracks EMA of model weights. This always improves test loss in my experiments, though ReSPlus also outperforms SPlus when weight EMA is disabled in both.

It doesn't really make sense because I was testing a stupid idea and seeing what would happen if I run it in shampoos eigenbasis and for some reason it worked well. I don't really know why though.


r/optimization • • Jul 24 '25

Optimization problem, using ADMM

0 Upvotes

Hello, I'm a PhD student and optimization is not my specialty but I do inverse imaging in the case of tomography images. I've been trying to solve a problem such that I minimize a L2 NORM + a 2D Huber Penalty : $f(x) + g(v) = \frac{1}{2}|| Ax -b ||{2}_{2} + \sum_i H_{T}(v_{i}), s.t. Dx = v, where D = (D_{h}, D_{v}).T and D_{h}x = z_{h}, D_{v}x = z_{v}. H_{T} is the Huber loss function and (D_{h}, D_{v}) are the gradients column and line wise (in order to apply it to a 2D image. x is a 2D image (n,n), A is a radon transform matrix (so shape is (m,n)) and b is a measured sinogram (m,n). The thing is, I don't trust AI and I wouldn't mind to have an insight on my reasoning and if what I'm doing makes sense. I tried using this presentation as support for my reasoning : https://angms.science/doc/CVX/TV1_admm.pdf (but the reasoning, even if understandable, goes pretty fast and I wonder if there's not a problem with the subproblem reformulation). My main question is, when we apply this, does that mean that in my case, the step where i will do the proximal descent (v step), i have to do v_i and then do the sum of all v_i resulting ? If you have any extra question dont hesitate, I went a little fast


r/optimization • • Mar 23 '26

Github Repo on Optimization in Energy

0 Upvotes

We wanted to share a Github Repo we recently stumbled upon built by the U.S. National Energy Modeling System (NEMS) with over 15 different modules on energy systems.

The repo consists of:

Four supply modules:

- Renewable Fuels Module (RFM)

-Natural Gas Market Module (NGMM)

- Hydrocarbon Supply Module (HSM)

- Coal Market Module (CMM)

Four demand modules:

- Residential Demand Module (RDM)

- Commercial Demand Module (CDM)

- Industrial Demand Module (IDM)

- Transportation Demand Module (TDM)

Three conversion modules:

- Electricity Market Module (EMM)

- Liquid Fuels Market Module (LFMM)

- Hydrogen Market Module (HMM)

Five other modules:

- Macroeconomic Activity Module (MAM)

- International Energy Module (IEM)

- Emissions Policy Module (EPM)

- Integrating Module Carbon Capture, Allocation, Transportation, and Sequestration (CCATS).

LFMM and CCATS use FICO Xpress for which you can get a free license depending on your setup. More details here: https://www.fico.com/en/fico-xpress-trial-and-licensing-options


r/optimization • • Jul 18 '21

Surpassing the pareto front in multi objective optimization

0 Upvotes

In real life multi objective optimization problems, is it ever possible to obtain a solution like the "black x" in this picture here?

https://imgur.com/a/UmXTQ64

I understand that usually in multi objective optimization problems, since there are so many criteria to be optimized - it is very unlikely to have a "globally best" solution. Usually, some solutions will be better in some of the criteria - and other solutions will be better in other criteria. For example, if you are trying to find airplane tickets and want to optimize cost/length of flight : it is very likely some tickets will be expensive and short, some tickets will be cheap and long, and some tickets will be in the middle.

But suppose the data is such - sometimes, we can stumble across a ticket that is both cheap and short. Thus, in this case - how does the concept of the Pareto Front apply over here? The Pareto Front would usually refer to a group of airplane tickets that "cannot be improved in any of the objectives without degrading at least one of the other objectives" ( source: https://en.wikipedia.org/wiki/Multi-objective_optimization). But suppose there was one airplane ticket that was both cheaper AND shorter than any other ticket - in this example, would the Pareto Front simply be made of this one "supreme point"?

Also, this must happen sometimes in real life - correct?

Thanks


r/optimization • • May 11 '23

Suppose a linear programming problem has n solutions.

0 Upvotes

In other words, n vectors x maximize function y. Is there a way of computing the value of n? Also, do determine the value of each vector?


r/optimization • • Apr 12 '26

Open-source Python library for structured optimization with user-defined proximal operators (consensus ADMM, C++ backend)

2 Upvotes

Hi r/optimization,

I'd like to share a Python optimization library I've been developing: admm — a consensus ADMM solver with automatic problem decomposition that handles LP, QP, SOCP, SDP, and extends to nonconvex formulations via user-defined proximal operators.

Algorithmic approach:

The solver implements consensus ADMM [Boyd et al., 2011]. Each atom in the user's objective (a norm, loss, or UDF) becomes a separate proximal subproblem sharing a consensus variable. The user writes the model in natural mathematical notation; the library handles the splitting, variable duplication, and consensus updates automatically.

The key extension point is the UDFBase class. You implement:

  • eval(x) — evaluate your function at x

  • argmin(λ, v) — solve the proximal subproblem: argmin_x λ·f(x) + ½‖x−v‖²

…and the solver treats it as a black-box proximal step within the ADMM loop. For smooth functions, an alternative path takes eval(x) + grad(x) and the C++ backend handles the proximal solve internally.

Why this matters — many "hard" penalties have cheap proximal operators:

PenaltyProximal operatorCost
L0 normHard thresholding: x·𝟙(x
Rank-r indicatorSVD + keep top-r singular valuesO(min(m,n)·r)
Binary {0,1}Round to nearest binaryO(n)
Stiefel manifoldSVD-based projection to orthonormal matricesO(n²k)
SCAD / MCPClosed-form thresholdingO(n)

These are all nonconvex — no DCP-based tool can express them. But ADMM with these proximal operators converges in practice, typically to good local optima.

Example — Graphical Lasso (sparse precision matrix estimation):

$$\min_{\Theta \succ 0} ; -\log\det(\Theta) + \operatorname{tr}(S\Theta) + \lambda|\Theta|_1$$

import admm
import numpy as np

np.random.seed(1)
p = 50
S = np.cov(np.random.randn(200, p).T)

model = admm.Model()
Theta = admm.Var("Theta", p, p, PSD=True)
model.setObjective(
    -admm.log_det(Theta) + admm.trace(S @ Theta) + 0.1 * admm.sum(admm.abs(Theta))
)
model.optimize()

Three atoms, each with a known proximal operator: log-det (eigendecomposition), trace (linear/trivial), L1 (soft-thresholding). The PSD constraint is enforced by projecting onto the PSD cone at each iteration.

Example — Nuclear norm matrix completion:

import admm
import numpy as np

np.random.seed(0)
m, n = 100, 80
M_true = np.random.randn(m, 5) @ np.random.randn(5, n)   # rank 5
mask = np.random.rand(m, n) > 0.7                          # 30% observed
obs = list(zip(*np.where(mask)))

model = admm.Model()
X = admm.Var("X", m, n)
model.setObjective(admm.norm(X, ord="nuc"))
for i, j in obs:
    model.addConstr(X[i, j] == M_true[i, j])
model.optimize()

Convergence properties:

  • Convex problems: Global convergence guaranteed (same as standard consensus ADMM)

  • Nonconvex UDFs (L0, rank, SCAD, MCP): No global optimality guarantee — the solver acts as a practical local method. In our experiments on L0-regularized regression, results are comparable to IHT and often better than convex relaxation (L1) for feature recovery

  • Rho adaptation: Residual-based rho updates following [Boyd et al., 2011, §3.4.1]

What's included:

  • Standard atoms: L1, L2, nuclear, Frobenius norms; Huber, logistic, hinge, pinball losses; log-det, trace, entropy

  • Dozens of UDF classes (proximal and gradient-based): L0, L½, rank, binary, SCAD, MCP, Cauchy, Welsch, Tukey, KL divergence, smooth TV, and more

  • PSD matrix variables, SDP support

  • C++ backend, MIT license

I'm a developer of this library. Happy to discuss algorithmic choices, convergence behavior, or comparisons with OSQP/SCS/ProximalAlgorithms.jl.


r/optimization • • Apr 24 '26

[New Optimizer] 🌹 Rose: low VRAM, easy to use, great results, Apache 2.0

6 Upvotes

Hello, World! I recently released a new PyTorch optimizer I've been researching and developing on my own for the last couple of years. It's named "Rose" in memory of my mother, who loved to hear about my discoveries and progress with AI.

Without going too much into the technical details (which you can read about in the GitHub repo), here are some of its benefits:

  • It's stateless, which means it uses less memory than even 8-bit AdamW. If it weren't for temporary working memory, its memory use would be as low as plain vanilla SGD (without momentum).

  • Fast convergence, low VRAM, and excellent generalization. Yeah, I know... sounds too good to be true. Try it for yourself and tell me what you think. I'd really love to hear everyone's experiences, good or bad.

  • Apache 2.0 license

You can find the code and more information at: https://github.com/MatthewK78/Rose

Benchmarks can sometimes be misleading. For example, sometimes training loss is higher in Rose than in Adam, but validation loss is lower in Rose. The actual output of the trained model is what really matters in the end, and even that can be subjective. I invite you to try it out for yourself and come to your own conclusions. With that said, here are some quick benchmarks.


MNIST training, same seed:

[Rose] lr=3e-3, default hyperparameters

Epoch 1: avg loss 0.0516, acc 9827/10000 (98.27%)
Epoch 2: avg loss 0.0372, acc 9874/10000 (98.74%)
Epoch 3: avg loss 0.0415, acc 9870/10000 (98.70%)
Epoch 4: avg loss 0.0433, acc 9876/10000 (98.76%)
Epoch 5: avg loss 0.0475, acc 9884/10000 (98.84%)
Epoch 6: avg loss 0.0449, acc 9892/10000 (98.92%)
Epoch 7: avg loss 0.0481, acc 9907/10000 (99.07%)
Epoch 8: avg loss 0.0544, acc 9918/10000 (99.18%)
Epoch 9: avg loss 0.0605, acc 9901/10000 (99.01%)
Epoch 10: avg loss 0.0668, acc 9904/10000 (99.04%)
Epoch 11: avg loss 0.0566, acc 9934/10000 (99.34%)
Epoch 12: avg loss 0.0581, acc 9929/10000 (99.29%)
Epoch 13: avg loss 0.0723, acc 9919/10000 (99.19%)
Epoch 14: avg loss 0.0845, acc 9925/10000 (99.25%)
Epoch 15: avg loss 0.0690, acc 9931/10000 (99.31%)

[AdamW] lr=2.5e-3, default hyperparameters

Epoch 1: avg loss 0.0480, acc 9851/10000 (98.51%)
Epoch 2: avg loss 0.0395, acc 9871/10000 (98.71%)
Epoch 3: avg loss 0.0338, acc 9887/10000 (98.87%)
Epoch 4: avg loss 0.0408, acc 9884/10000 (98.84%)
Epoch 5: avg loss 0.0369, acc 9896/10000 (98.96%)
Epoch 6: avg loss 0.0332, acc 9897/10000 (98.97%)
Epoch 7: avg loss 0.0344, acc 9897/10000 (98.97%)
Epoch 8: avg loss 0.0296, acc 9910/10000 (99.10%)
Epoch 9: avg loss 0.0356, acc 9892/10000 (98.92%)
Epoch 10: avg loss 0.0324, acc 9911/10000 (99.11%)
Epoch 11: avg loss 0.0334, acc 9910/10000 (99.10%)
Epoch 12: avg loss 0.0323, acc 9916/10000 (99.16%)
Epoch 13: avg loss 0.0310, acc 9918/10000 (99.18%)
Epoch 14: avg loss 0.0292, acc 9930/10000 (99.30%)
Epoch 15: avg loss 0.0295, acc 9925/10000 (99.25%)

I used a slightly modified version of this: https://github.com/facebookresearch/schedule_free/tree/main/examples/mnist

Highest accuracy scores from 20 MNIST training runs (20 epochs each) with different seeds:

from scipy.stats import mannwhitneyu

rose = [99.34, 99.24, 99.28, 99.28, 99.24, 99.31, 99.24, 99.21, 99.25, 99.33, 99.29, 99.28, 99.27, 99.30, 99.33, 99.26, 99.29, 99.26, 99.32, 99.25]
adamw = [99.3, 99.15, 99.27, 99.2, 99.22, 99.3, 99.22, 99.15, 99.25, 99.29, 99.2, 99.22, 99.3, 99.23, 99.2, 99.25, 99.22, 99.28, 99.32, 99.22]

result = mannwhitneyu(rose, adamw, alternative="greater", method="auto")
print (result.statistic, result.pvalue)

Mann-Whitney U result: 292.0 0.006515916656300127


Memory overhead (optimizer state relative to parameters):

  • Rose: 0×

  • SGD (no momentum): 0×

  • Adafactor: ~0.5-1× (factorized)

  • SGD (momentum): 1×

  • AdaGrad: 1×

  • Lion: 1×

  • Adam/AdamW/RAdam/NAdam: 2×

  • Sophia: ~2×

  • Prodigy: ~2-3×


OpenAI has a challenge in the GitHub repo openai/parameter-golf. Running a quick test without changing anything gives this result:

[Adam] final_int8_zlib_roundtrip_exact val_loss:3.79053424 val_bpb:2.24496788

If I simply replace optimizer_tok and optimizer_scalar in the train_gpt.py file, I get this result:

[Rose] final_int8_zlib_roundtrip_exact val_loss:3.74317755 val_bpb:2.21692059

I left optimizer_muon as-is. As a side note, I'm not trying to directly compete with Muon's performance. However, a big issue with Muon is that it only supports 2D parameters, and it relies on other optimizers such as Adam to fill in the rest. It also uses more memory. One of the biggest strengths of my Rose optimizer is the extremely low memory use.

Here is a more detailed look if you're curious (warmup steps removed):

[Adam]

world_size:2 grad_accum_steps:4
sdp_backends:cudnn=False flash=True mem_efficient=False math=False
attention_mode:gqa num_heads:8 num_kv_heads:4
tie_embeddings:True embed_lr:0.05 head_lr:0.0 matrix_lr:0.04 scalar_lr:0.04
train_batch_tokens:16384 train_seq_len:1024 iterations:200 warmup_steps:20 max_wallclock_seconds:600.000
seed:1337
< 20 warmup steps were here >
step:1/200 train_loss:6.9441 train_time:156ms step_avg:155.60ms
step:2/200 train_loss:18.0591 train_time:283ms step_avg:141.70ms
step:3/200 train_loss:12.4893 train_time:373ms step_avg:124.43ms
step:4/200 train_loss:7.8984 train_time:461ms step_avg:115.37ms
step:5/200 train_loss:6.7623 train_time:552ms step_avg:110.46ms
step:6/200 train_loss:6.7258 train_time:640ms step_avg:106.74ms
step:7/200 train_loss:6.5040 train_time:729ms step_avg:104.14ms
step:8/200 train_loss:6.5109 train_time:817ms step_avg:102.16ms
step:9/200 train_loss:6.1916 train_time:906ms step_avg:100.61ms
step:10/200 train_loss:6.0549 train_time:994ms step_avg:99.45ms
step:200/200 train_loss:3.8346 train_time:18892ms step_avg:94.46ms
step:200/200 val_loss:3.7902 val_bpb:2.2448 train_time:18893ms step_avg:94.46ms
peak memory allocated: 586 MiB reserved: 614 MiB
Serialized model: 67224983 bytes
Code size: 48164 bytes
Total submission size: 67273147 bytes
Serialized model int8+zlib: 11374265 bytes (payload:17178912 raw_torch:17224025 payload_ratio:3.91x)
Total submission size int8+zlib: 11422429 bytes
final_int8_zlib_roundtrip val_loss:3.7905 val_bpb:2.2450 eval_time:67924ms
final_int8_zlib_roundtrip_exact val_loss:3.79053424 val_bpb:2.24496788

[Rose]

optimizer_tok = Rose([{"params": [base_model.tok_emb.weight], "lr": token_lr, "base_lr": token_lr}], lr=token_lr, stabilize=False, compute_dtype=None)

optimizer_scalar = Rose([{"params": scalar_params, "lr": args.scalar_lr, "base_lr": args.scalar_lr}], lr=args.scalar_lr, stabilize=False, compute_dtype=None)

world_size:2 grad_accum_steps:4
sdp_backends:cudnn=False flash=True mem_efficient=False math=False
attention_mode:gqa num_heads:8 num_kv_heads:4
tie_embeddings:True embed_lr:0.05 head_lr:0.0 matrix_lr:0.04 scalar_lr:0.04
train_batch_tokens:16384 train_seq_len:1024 iterations:200 warmup_steps:20 max_wallclock_seconds:600.000
seed:1337
< 20 warmup steps were here >
step:1/200 train_loss:6.9441 train_time:173ms step_avg:173.15ms
step:2/200 train_loss:6.4086 train_time:305ms step_avg:152.69ms
step:3/200 train_loss:6.2232 train_time:433ms step_avg:144.21ms
step:4/200 train_loss:6.1242 train_time:557ms step_avg:139.24ms
step:5/200 train_loss:5.9950 train_time:681ms step_avg:136.23ms
step:6/200 train_loss:6.0386 train_time:806ms step_avg:134.38ms
step:7/200 train_loss:5.9189 train_time:933ms step_avg:133.22ms
step:8/200 train_loss:5.8817 train_time:1062ms step_avg:132.78ms
step:9/200 train_loss:5.5375 train_time:1192ms step_avg:132.43ms
step:10/200 train_loss:5.4599 train_time:1322ms step_avg:132.25ms
step:200/200 train_loss:3.7445 train_time:24983ms step_avg:124.91ms
step:200/200 val_loss:3.7390 val_bpb:2.2144 train_time:24984ms step_avg:124.92ms
peak memory allocated: 584 MiB reserved: 612 MiB
Serialized model: 67224983 bytes
Code size: 48449 bytes
Total submission size: 67273432 bytes
Serialized model int8+zlib: 11209724 bytes (payload:17178912 raw_torch:17224025 payload_ratio:3.91x)
Total submission size int8+zlib: 11258173 bytes
final_int8_zlib_roundtrip val_loss:3.7432 val_bpb:2.2169 eval_time:65817ms
final_int8_zlib_roundtrip_exact val_loss:3.74317755 val_bpb:2.21692059

Visual comparisons of training between AdamW and Rose: https://www.reddit.com/r/StableDiffusion/comments/1ss85os/training_comparison_adamw_on_the_left_rose_on_the/


[Update Rule]

# 1. Decoupled weight decay
θ ← (1 − η_wd · λ) · θ

# 2. Gradient centralization (optional)
g̃_i ← g_i − mean(g_i)          # mean over all non-leading axes

# 3. Per-slice range
R_i ← |max(g̃_i)| − min(g̃_i)   # one scalar per slice

# 4. CV trust gating (optional)
μ_R ← mean(R),  σ_R ← std(R)   # across all slices
τ  ← μ_R / (σ_R + μ_R)         # equivalently 1/(1 + CV)
D_i ← (1 − τ) · μ_R + τ · R_i  # lerp between global and local

# 5. Update
θ ← θ − η · g̃ / D

r/optimization • • Jun 01 '26

NuCS vs Choco: a pure-Python solver meets a JVM veteran. NuCS (https://github.com/yangeorget/nucs), a constraint solver written entirely in Python, is benchmarked against Choco (https://github.com/chocoteam/choco-solver), a mature Java solver with two decades of optimization behind it.

Thumbnail
github.com
0 Upvotes
NuCS (https://github.com/yangeorget/nucs), a constraint solver written entirely in Python, is benchmarked against Choco
(https://github.com/chocoteam/choco-solver), a mature Java solver with two decades of optimization behind it. The
results upend the expected mismatch.

Same model, same speed. Run both on an identical formulation and the curves overlap — NuCS even pulls ahead on the
largest instances. Once Numba compiles the inner loops, the Python penalty disappears.

Different models, decisive wins. On Latin squares and magic sequences, NuCS is 13x and 40x faster — not because of the
language, but the model. Cheap redundant constraints and channeling recover most of what Choco's heavyweight
arc-consistent globals provide, at a fraction of the per-node cost.

Where Choco holds the edge. On the Golomb ruler, its richer domains prune in ways plain NuCS can't — until a short
custom propagator closes the gap to within 2%.

The root cause. One design choice explains everything: NuCS stores each domain as a min..max interval (compact,
vectorizable, but limited to bound consistency), while Choco can remove values from the middle of a domain and run full
arc consistency. That single difference shapes what each solver is good at.

There's no overall winner — just two different bets. Choco offers a deep catalog of battle-tested global constraints;
NuCS lets you reshape a model in a few lines of Python and still get native-code speed. Increasingly, that modeling
freedom matters more than raw engine performance.

NuCS (https://github.com/yangeorget/nucs), a constraint solver written entirely in Python, is benchmarked against Choco
(https://github.com/chocoteam/choco-solver), a mature Java solver with two decades of optimization behind it. The results upend the expected mismatch.

r/optimization • • Dec 04 '24

Can AI code an entire optimization model?

7 Upvotes

In this article we pursue an ambitious goal: Create an entire, non-trivial optimization model using Artificial Intelligence (AI).

Our approach mimics a user who is familiar with the situation, and has some experience with formulating optimization models, but is not familiar with implementing an optimization model in Python code. We want the AI to do all the coding for us.

We report our experience of using Copilot to write a model for us. Rather than presenting a verbatim transcript, which is very long, we focus on what went well and what didn't go well as the model evolves. We also summarize general lessons from the process.

https://www.solvermax.com/blog/can-ai-code-an-entire-optimization-model


r/optimization • • Oct 25 '21

HW help

Post image
2 Upvotes

r/optimization • • Apr 02 '26

Posting here because I think this might be useful for people working on combinatorial problems

2 Upvotes

A bit of background before the link: I'm 49, in my first year of an aerospace degree, and I have dyscalculia — which means I can't reliably process numbers but I think very naturally in shapes and spatial structures.

I needed to optimise an aerofoil profile for a hand-thrown glider project. Commercial optimisation software was expensive and the free alternatives I found were either toy implementations in pure Python (painfully slow) or academic code from 2018 that nobody had maintained. So I built my own.

I didn't derive the algorithm from equations — I designed it by thinking about energy landscapes as physical terrain. Multi-dimensional valleys, barriers you can tunnel through rather than climb over, swarms of particles exploring the landscape in parallel. The maths came after, to validate what the visual model was already doing.

The result is Loucetius — a GPU-accelerated QUBO solver with four engines:

LOCETIUS — spectral swarm annealing, 64 parallel worlds on CUDA

KERR — continuous-variable wave oscillators borrowed from quantum optics (sub-millisecond on medium problems)

HYBRID — blends both with a tunable weight; optimal around w=0.75 in testing

SPARSE — native cuSPARSE for large sparse problems (tested to 15K variables)

It auto-routes problems to the best engine based on the Q matrix structure. It also works as a drop-in replacement for D-Wave/PyQUBO code — one line change.

It's completely free. AGPLv3 for research/open-source, commercial licence available if anyone finds a use for it.

https://github.com/ceh303-tech/loucetius

There's a test_quick.py you can run immediately after cloning to verify it works on your hardware. CUDA 12.1+ and an RTX-era GPU required.

I genuinely don't know how it compares to commercial solvers on standardised benchmarks — I don't have access to known-optimal solutions for the test instances I used. If you run it on a problem where you know the optimal, I'd love to hear how it did. That's partly why I'm posting — I want people to test it and tell me.


r/optimization • • Oct 14 '21

Optimisation discord server

0 Upvotes

r/optimization • • Jan 21 '21

Optimized Employee Schedule

1 Upvotes

Hello Everyone,

I have a headcount model that creates shifts for a call center and then assigns them to (Month Lines) which is simply a schedule for a person in a given month. The model runs for 1 year and outputs the shifts that I put into those month lines (Using VBA).

However, I am thinking I am not putting them in optimal lines due to the large headcount it suggests and the many unassigned shifts. Right now I am using more of brute force technique to assign them to a specific line based on Shift start variance and set days off, looping through 80K shifts.

Does anyone know of an algorithm or resource that may help me translate this into the code?

It is written in VBA and is not very good, but it largely gets the job done.

The Model:

The model determines the number of people required in 30 minute increments throughout the day using call volume and productivity matrices I.E. (In a 30 minute period, a call agent has 20 productive minutes) and then schedules people accordingly creating shifts.

Therefore, a shift can start and end in any 30 minute increment throughout the day. The call center is 24 hours.

Once the shifts for each day in a month are created, they are then organized into monthly lines using some constraints such that there can be no more than 5 shifts a week, no shift in their schedule for the month may start greater than two hours from thier initial shift start time that month, and they must have two consistent days off.

The problem really is that I have no optimization in here, the way it is done currently looks like this:

Find the first shift of the month,

Then, find the next shift that starts a different day if and only if it's within two hours of that first shift's start time, it is not on one of this shift lines days off, and the schedule hasnt already had 5 shifts in that week for this specific month line.

Sorry thats a mouth full.

But do you see the problem? It brute foreces its way through each shift instead of finding the optimal shift for each schedule thus minimzing the number of people required. See, the number of workers is determined by how many it takes to satsify each

Please let me know if you have any other questions.

I have looked into the following resources to no avail:

https://developers.google.com/optimization/scheduling/employee_scheduling

https://softwareengineering.stackexchange.com/questions/236668/what-algorithm-should-i-use-to-create-an-automatic-staff-scheduling-feature

https://stackoverflow.com/questions/17140179/optimal-shift-scheduling-algorithm

These papers are informative but, due to my naivity, not quite as exemplary or practical as I am seeking.


r/optimization • • Jul 15 '21

Can someone please explain to me why this problem is considered impossible?

1 Upvotes

Suppose you have a function ("f") that takes three inputs (x, y, z) and outputs "w".

I have been told that the following problems are impossible:

- for the function "f", find the point which has the "relative largest" values of all "x, y, z and w"

- for the function "f", find the point which has the "relative smallest" values of all "x, y, z and w"

- for the function "f", find the point which has the "relative smallest" values of all "x, y, z" and the largest value of "w"

- for the function "f", find the point which has the "relative largest" values of all "x, y, z" and the smallest value of "w"

Can someone please explain why this problem is considered "impossible"?

Thanks


r/optimization • • 4d ago

ArcLP: A Matlab Implementation of an 𝒪(√nL) Arc-search Infeasible Interior-Point Algorithm for Linear Programming

Thumbnail openresearchsoftware.metajnl.com
1 Upvotes

https://openresearchsoftware.metajnl.com/articles/10.5334/jors.674 arcLP is about an implementation of an arc-search infeasible interior-point algorithm for linear programming. The algorithm has a polynomial time with the best polynomial bound. The paper and software can be downloaded from the website. Along with arcLP, an implementation of Mehrotra’s algorithm and netlib benchmark test problems can also be downloaded, tested, and compared to the arcLP to verify the reported results in the paper.


r/optimization • • Sep 20 '25

🚀 Demo: My Logistics Hypercomputer API – Handles 10k × 500 Cost Matrices in Under a Second

0 Upvotes

Hey everyone, I’m sharing a live demo of my Logistics Hypercomputer API. It solves combinatorial assignment problems (logistics, scheduling, matching, etc.) using a cost matrix, optional capacities, demands, and constraints. The demo is open today from 3PM to 8PM AWST.

You can upload your dataset directly on the web page and get best routes, fallback routes, utilization stats, and CSV downloads.

Live Demo (Ngrok link): https://566ad33710de.ngrok-free.app

CSV Input Example

1️⃣ Cost Matrix (cost_matrix.csv)
Rows = warehouses, Columns = routes

10, 20, 15
5, 12, 8
7, 14, 10

2️⃣ Capacities (capacities.csv) (optional)
Columns = routes

15, 10, 20

3️⃣ Demands (demands.csv) (optional)
Rows = warehouses

5, 7, 6

4️⃣ Constraints (constraints.csv) (optional)
Format: w1,r1,w2,r2 → “if warehouse w1 uses route r1, warehouse w2 cannot use route r2”

0,0,1,1
2,2,0,1

Usage Notes:

  • Upload .csv or .json files. Gzip is supported.

  • Check “Use Global Optimum” to guide the solver toward the minimal cost baseline.

  • Progress and queue position are shown live.


r/optimization • • Mar 16 '26

Is your QUBO failing because of the solver or the formulation?

0 Upvotes

Hey everyone! I’ve just built QuboAuditor to answer the question: "Is your QUBO failing because of the solver or the formulation?" - a Python-based diagnostic tool designed to "peer inside" the black box of QUBO landscapes before you hit the QPU.

📦 GitHub: https://github.com/firaskhabour/QuboAuditor

📜 Citable DOI: https://doi.org/10.6084/m9.figshare.31744210

The Need: We’ve all been there, your energy gap is too small, or your constraints are drowning out your objective, and the solver returns garbage. I built this to help identify why a formulation is failing measure its spectral charactoristics.

What it does:

-Roughness Index r(Q): Quantifies the "ruggedness" of your landscape to predict solver success.

-Penalty Dominance Ratio (PDR): Identifies if your constraint penalties are scaled so high they've destroyed your objective's gradient.

-Scientific Rigor: Implements the F.K. (2026) 10-seed reproducibility protocol as a default to ensure your metrics aren't just noise.

How to use it:

You may run it directly on your QUBO in one line on Python. It’s fully API-enabled. You can integrate it into your pipeline with a single import: Python "from qubo_audit import QUBOAuditor"

I’d love for people to test this on their messiest problem sets. Does the Roughness Index correlate with what you're seeing on hardware?


r/optimization • • Nov 02 '24

How to make renting apartments math precise?

0 Upvotes

Im wondering if it is possible to create a math model for renting choices.... Not sure how to incorporate my priorities, put good AC/kitchen/location into the formula, optimize etc... Should I try optimization theory?


r/optimization • • Apr 02 '23

How to select the best threshold for your model

0 Upvotes

Hi there,

I have made a video here where I explain how to select the best threshold for your model by looking at the ROC curve.

I hope it may be of use to some of you out there. Feedback is more than welcomed! :)


r/optimization • • May 06 '23

Looking for Help with an CPLEX Optimization Problem

0 Upvotes

Hey Guys, just like the title says, I'm looking for a hand with a CPLEX problem I'm currently tackling, I've got most of it working except one little thing, and would like some advice. Please let me know and I'll shoot you a message!


r/optimization • • Oct 30 '23

📈 #12 From Pizzerias to Paramedics: How VRP is Transforming Modern Logistics

0 Upvotes

🍣 Uber Eats, DoorDash, FedEx, UPS, ambulances...

They all solve the 🚚 Vehicle Routing Problem (VRP) to:
· Minimize costs
· Arrive on time to emergencies

UPS saved $50M in 2013 💸 when they started solving it efficiently.

Do you want to know more? 👉 Read it in Feasible newsletter


r/optimization • • Nov 20 '20

I would appreciate some enlightenment in regards to LPP

0 Upvotes

Explain the significance of surplus and slack variable with a numerical example.


r/optimization • • Dec 10 '21

GAMS - Is There A Shortcut For Defining Variables With Multiple Indices?

0 Upvotes

Indices

x : Products (1, 2, 3)

y : Markets (1, 2, 3, 4, 5)

Variables

b : Selling Price

bxy : Selling Price Of the Product x on the Market y

It takes too long to write all of them for large models like;

option optar = 0,00;

variable

b11, b12, b13, b14, b15, b21, b22, b23 ... ;

Is There A Shortcut For Defining Variables With Multiple Indices?