DataModel: validate constraint array lengths against the row count
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 50/100
Direzione di ricerca
Start in the setters in data_model_wrapper.pyx that store rhs, row types and the constraint lower/upper bounds, and compare their lengths with len(A_offsets) - 1. First check whether the C++ data_model_view already validates these sizes, since that decides where the check belongs. Done means a clear ValueError for mismatched lengths or half-set bounds, plus a test that covers the bounds-only path used by cvxpy, pyomo and linopy.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
DataModel accepts two row representations: rhs + row types (set_constraint_bounds, set_row_types) and lower/upper bounds (set_constraint_lower_bounds, set_constraint_upper_bounds). The setters in data_model_wrapper.pyx store whatever array they receive. Nothing checks that its length equals the row count implied by A_offsets (len(A_offsets) - 1).
The solve path then passes each array to the C++ data_model_view with its own shape[0]. Any consumer that assumes one representation, or assumes the sizes match, can read out of bounds. #2249 is one instance, in _compute_slack_csr, which indexed rhs[i] and sense[i] when only the bounds were set. cvxpy, pyomo and linopy all use set_constraint_lower_bounds, so this path is exercised by third-party interfaces.
Proposal
Validate at the Python boundary (the setters, or the solve entry once the matrix is known):
rhs,row_types,constraint_lower_boundsandconstraint_upper_boundsmust each be empty or have length equal to the row count.- Lower and upper bounds must be set together or not at all.
- Raise a clear
ValueErrorotherwise.
Optionally, as Ishika Roy suggested, normalize so that rhs + sense is always converted to lower/upper bounds when the model is built, so consumers only deal with one representation. That is a larger change and could be a second step.
Open question
Does the C++ data_model_view already validate these sizes against the row count? That needs checking, since the Python-side check would then be a duplicate of it.
Related: #2249, #2253, #1615.
- Lingua principale
- Cuda
- Stelle
- 1.1k
- Fork
- 249
- Merge medio
- 1g 15h
- PR unite (30g)
- 124
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NVIDIA/cuopt
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 32/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
NVIDIA/cuopt#2255 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] Out-of-bounds read when solving a DataModel with lower/upper constraint boundsForse già presa @ramakrishnap-nv l’ha presa 1 giorno fa. Apertabug
Difficoltà 3/5 Mezza giornata Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di NVIDIA/cuopt
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
`contacts.create` posts to `/audiences/undefined/contacts` when `audienceId` is undefinedForse già presa @RaphaelFakhri l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
resend/resend-node#1176 ·
I maintainer di solito rispondono entro 1 giorno
-
EntitlementInfo.originalPurchaseDate returns the latest purchase date for subscriptionsForse già presa @RaphaelFakhri l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
RevenueCat/purchases-js#1295 ·
I maintainer di solito rispondono entro 1 giorno
-
2022 2023 AR
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
PolicyEngine/policyengine-taxsim#1506 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
DiamondLightSource/fastcs#443 ·