Questions tagged [constraints]

A constraint is a condition that has to be fulfilled in a given context. Constraints are typically used in databases and programming languages to detect errors, ensure data consistency, accuracy, and to enforce business requirements.

Filter by
Sorted by
Tagged with
0 votes
0 answers
5 views

Symfony 2.8 : why validator (constraint & validator) are not executed when I edit my entity

I'm working on a legacy code from Symfony 2.8. There is a custom constrain on a date property of an entity. When I create a new entry of this entity via a form, if I don't respect the constraint the ...
SanLucos's user avatar
1 vote
0 answers
51 views

Create a Conditional Constraint without a trigger

I would like to create a database constraint that would disallow all of the child records from being VOIDded. For any given Transaction there can be many work orders. I want the database to prevent ...
Mark H's user avatar
  • 11
0 votes
1 answer
50 views

Content hugging and content compression resistance with minimum margin between views

I was trying to create a UI with two labels placed horizontally in parallel to other edges on the screen so that they can grow according to the content they receive. and I tried setting up content ...
Maverick's user avatar
-2 votes
0 answers
30 views

Symfony 6 Autocomplete field validation no constraint

I have an autocomplete field. I want to allow all strings. I tried with this additional code: 'constraints' => [new NotBlank()], But it doesn't work. The validator only allows the "allowed&...
kiterstefan's user avatar
1 vote
0 answers
43 views

What constraints does a Wrap pass to its children?

flutter: What constraint a Wrap passes to its children? Inside a scrollView: SingleChildScrollView( child: Wrap( direction: Axis.vertical, children: [child1, child2, child3] ) ) ...
eastwater's user avatar
  • 4,812
1 vote
1 answer
135 views

Can I restrict or constrain an SQL table with Start and End dates, to only allow one "active" row

PROBLEM: with a given SQL Server table, is it possible to 'constrain' or use a 'unique index' so it only allows users to enter rows where we have only one "Active/Live" row based on the ...
DreamInBytes's user avatar
1 vote
2 answers
81 views

Writing Objective Function using scipy.optimize.minimize Troubleshoot

I am trying to solve an optimization problem applied to bridges, in the context of a parametric design. The objective function is to try and split precast barriers into a minimum amount of unique ...
Dragos Seculin's user avatar
0 votes
1 answer
46 views

Why does this Prolog program not terminate?

I’m new to Prolog and I wanted to write a simple predicate that checks if a given value is in a list. I do not know exactly if the way I was taught lists is correct. I was taught that it is a car/cdr ...
schuelermine's user avatar
  • 2,016
-1 votes
7 answers
305 views

Counting the Number of Combinations that Match a Certain Condition

Here is my problem: There are 5 candies (1,2,3,4,5) - each candy has the same "value" associated with its number (i.e. candy_1 has value=1, candy_2 has value=2, etc.). In the future, I ...
stats_noob's user avatar
  • 5,265
0 votes
2 answers
28 views

How make to correctly logical implication in CP's Cplex

I'm new to CPLEX, and I'm doing a project using CP. I have a multilist A that has 4 arguments : one Operation o, one Surgeon s, one Room r and one Time t A[o,s,r,t] == 1 if and only if the operation ...
Marcocorico's user avatar
0 votes
1 answer
44 views

Integer Programming Constraint For NOR Gate

For a set of binary variables X = {x1, x2, ..., xn} (n>=1). Lets define sum operation for simplicity: sum(X) = x1 + x2 + ... + xn For another binary variable y, I want to write a constraint or more ...
Jengador's user avatar
1 vote
0 answers
42 views

SQL relationship accessible via two properties and how to enforce this relationship when inserting data

I have a SQL database that I have modelled by EF Core code first approach. The problem I'm facing is related to only a small part of that model, so I will isolate it and try to explain the issue with ...
olejhar's user avatar
  • 11
1 vote
2 answers
38 views

Postgres - how to add foreign key nullable constraint for two different columns coming from diff tables

I have three tables 1. Account 2. dept and 3. managers In the managers table I need to add both account key and dept key as foreign key but one will null and other will have value, means if inserted ...
user1551426's user avatar
0 votes
1 answer
41 views

Set Different Constraint in StackView

Q. How to make different constraint each views, in stackview, UIKit? I want to make screen like captured one. In below code, the result is ok. but I have errors Unable to simultaneously satisfy ...
KEATON's user avatar
  • 35
0 votes
1 answer
75 views

how can i put a check constraint to the phone number in mysql? [duplicate]

to check the phone number that it should be of the 10 digits , so how can i put the check constraint so that it will be validated i try using the simple technique but i guess it will check only the ...
Pranjal Jain's user avatar
0 votes
0 answers
27 views

Scipy.optimize.minimize is not working well with these 3 constraints

I have 4 datasets with the same length (701). The first represents the x values (station). The others the y values: one from a measurement (scannedCSLeft), and the rest are representing the permitted ...
Dénes Nagy's user avatar
1 vote
0 answers
48 views

Assigning judges to entries using linear programming in R

I want to assign 4 judges to mark 15 entries, such that: Each entry is marked by exactly 2 judges; Each judge marks an equal number of entries (or close to equal given that the number of entries is ...
Hi_Viz's user avatar
  • 59
0 votes
0 answers
12 views

Adjusting numbers in a list based on constraints

I have a list of numbers and confidences in this numbers, for ex. [(24, 0.2), (23, 0.3), (21, 0.3), (19, 0.1), (18, 0.15), (18, 0.2), (17, 0.3), (13, 0.3), (12, 0.2), (12, 0.3), (11, 0.2), (11, 0.1), (...
Artsiom Hramyka's user avatar
0 votes
0 answers
23 views

How to set google experimental audio media constraints on getUserMedia

When using Google Meet, there are several unpublished audio constraints that get set. Looking at webrtc-internals shows the audio constraints as: {deviceId: {exact: ["default"]}, advanced: [...
wanderingcode's user avatar
1 vote
1 answer
34 views

Creating a check constraint using liquibase

What are the options for adding check constraints to columns in tables when using Liquibase? I have tried using the Liquibase checkConstraint attribute, but it doesn't seem to work, possibly because ...
ShipIM's user avatar
  • 13
3 votes
1 answer
114 views

Populate dataset with random amounts within nominated constraints

I am trying to create a fantasy cricket team of 11 players from a large list of players. For the team, I have basic minimum and maximum requirements for each type of player. I have assigned values ...
Mira's user avatar
  • 111
0 votes
0 answers
15 views

Pyomo - how to initialize an expression for t=0 within a constraint function

While creating constraint for time-indexed model, is there a way to initialize a constraint expression for t=0 instead of using if-else? My current code: def soc_constraint(model, t): if t==1: return ...
kelly_dias_00's user avatar
0 votes
0 answers
52 views

Constrained Optimization in R (find parameter)

I have a predator(Humans)–prey(fish) model under the following system of equations: dx/dt = ax−gx^2 − bxy dy/dt = −cy + dx*y I would like to find the minimum value for "b" (with R code), at ...
PVB's user avatar
  • 1
-1 votes
2 answers
49 views

Xcode preview error - '@objc' can only be applied to an extension of a class

I am using Xcode 14.2 with both a SwiftUI file as well as an Objective-C file. It uses NotificationCenter to change my text and labels that I have within my SwiftUI. Part of my text (fourLinesText) is ...
Summer's user avatar
  • 65
3 votes
1 answer
142 views

How do you constrain Visual studio Code Snippets to a type/class context?

In my project I use reflection to find and invoke certain (optional) methods, rather than defining an interface which forces the methods to be implemented. This is partly to support parameter ...
Dom's user avatar
  • 43
0 votes
0 answers
20 views

Deleting register by Id of entity that has a lot of foreign keys

I'm trying to delete a register by the id of the entity veiculo through a stored procedure. I pasted the whole procedure below. When I execute it, I get this error: Msg 4145, Level 15, State 1, Line ...
Gabriel Andrade Guimarães's user avatar
0 votes
0 answers
20 views

Pyomo constraint function: Which is more expensive, embedding if-else within the function or create a new binary parameter in the expression?

While creating a constraint definition for pyomo model with time-series (8760-step) indices, some parts of expression needs to be left out, conditional to a user-defined input (True/False) (a) def ...
kelly_dias_00's user avatar
1 vote
1 answer
41 views

OptaPlanner - How to configure a selectionFilter in construction heuristics phase?

I am trying to add a selectionFilter during the CH phase as below in solverConfig.xml: <constructionHeuristic> <constructionHeuristicType>FIRST_FIT</...
sicario_23's user avatar
1 vote
1 answer
60 views

Using validator.getConstraintsForClass on an annotation gives different result than using getConstraintsForProperty containing the annotation

I have a number of Java Annotation classes. The idea is that developers/consumers of my project will use these annotations on fields inside their POJOs in order to describe each field. Example ...
bobbyrne01's user avatar
  • 6,377
-1 votes
1 answer
86 views

Define Piecewise Function as a Constraint in Julia

I have an optimization model to which I need to add the following piecewise function as a constraint: C_{i,k} = { PR_{i} * HSE_{k} i∈Ω, k = 1,...,M, 1 i∈Ω, k = 1,...,M ...
Jesper's user avatar
  • 23
0 votes
1 answer
38 views

Optimization in Employee Rostering: Minimizing Employees while Maximizing Shift Assignments

I'm working on an employee rostering problem where I want to minimize the number of employees used while ensuring that each employee is assigned to the maximum number of shifts possible. I have ...
sicario_23's user avatar
1 vote
2 answers
89 views

C# Generic with class constraint

I am studying C# and generics with class constraint like public class GenericList<T> where T : Employee I am puzzled because I see nothing generic here. The GenericList list is bound to the ...
ILIIA CHTEREV's user avatar
-1 votes
1 answer
37 views

JPA embeddable class constraints not used in embedding class table

I have an issue with the DDL generated from an embeddable class. The annotations on the properties of the embeddable are not carried over to the embedding class table, such as NOT NULL. @Entity public ...
Peter Molnar's user avatar
0 votes
1 answer
22 views

How to do a constrain in Gurobi

I have a constrain i dont know how to do in gurobi if someone can help me This is what i try in the first but i dont know if is correct T = range(25) TL = range(21) X=model.addVars(E,T,S,vtype=GRB....
BENJAMÍN IBÁÑEZ's user avatar
0 votes
0 answers
43 views

Constrained interpolation to fill gaps in a time series with R

I have a time series with some missning values (NA's) which I want to interpolate in a nonlinear way. I know that the missing values are in a given interval, but this is block-specific. My data looks ...
Felix's user avatar
  • 1
2 votes
2 answers
37 views

Create a constrained randomized list of elements using two rules

I'm trying to create a randomized list of 32 items (these are experimental items) using R, with the following constraints: Items 1 to 24 have three different conditions, being item 1 condition 1; ...
Andrés Contreras Barros's user avatar
0 votes
0 answers
40 views

Placing tower on Minizinc

I need to maximize the number of red towers and blue tower placed on an NxN matrix. However, towers of different colors cant be on the same column, line or diagonal (in any direction). There also must ...
Loïc Pagé-Dorlot's user avatar
0 votes
1 answer
41 views

Valdiator for related entites

I have two entities, i want to have a custom validator constraint to ensure that both entities share one value. Example: Entity Region: has field city has multiple houses as OneToMany relation ...
endo.anaconda's user avatar
0 votes
1 answer
26 views

How to define a parameter

I want to write a constraint and for that, I need to define a parameter called the travel time of the vehicle 's' from node 'm' to 'n'. I have defined the travel time in tuple form i.e. given below: ...
VANDANA KUMARI's user avatar
0 votes
0 answers
38 views

Complex constraints in SciPy minimize

I am trying to set up a few constraints for my minimization problem which looks as below: result = minimize(objective_func, initial_guess, constraints=all_constraints) where the initial_guess = [0, 0, ...
TheSciCoder's user avatar
0 votes
1 answer
53 views

Django Meta.constraints are not working in my models

I'm trying to define a unique constraint for two primary keys in my model, because they are referenced by other models. And ent_ruc cant be unique. Must be unique together with ent_id. class ...
soyunewok's user avatar
  • 117
0 votes
1 answer
33 views

OR-tools routing constraint, that compares demand and capacity

Currently working on a routing problem and our transport has a specific condition - it can't travel half-full (delivers hazardous liquids), so basically it should be empty or almost empty after ...
maxvelichko26's user avatar
0 votes
1 answer
31 views

How to run two-way ANOVA when continuously getting ValueError: must have at least one row in constraint matrix

When I try to run the ANOVA, I get a "ValueError: must have at least one row in constraint matrix" message. See an example table below and the code that I am trying to run. You can ignore ...
rpn's user avatar
  • 21
0 votes
1 answer
41 views

How to insert a check constraint

The aim is to insert a check constraint for the row titles, 'ppl_tshirt_size' that limits it to a few values (sm,med,lg,xl,xxl) but not an enum data type. What am I not understanding? Additionally, ...
Anonymous's user avatar
-1 votes
2 answers
77 views

Formulating an optimization problem with non linear constraints

I am trying to solve a dynamic machine scheduling problem using what I think qualifies as a non linear programming constraints. I have academic knowledge of linear programming techniques and ...
Titi's user avatar
  • 147
0 votes
0 answers
31 views

How to convert the following if-else conditions to Linear integer programming constraints?

if x ≥ 100, then x -100 + p(x) ≤ 0; else p(x) ≤ 0 p(x) is a linear function. We can add x ≥ 0 if it could make it easy. I tried to make a binary variable z, if x ≥ 100, then z=1; else z=0. Then we got ...
Yinuo SHI's user avatar
0 votes
0 answers
31 views

Function to check if a dynamic constraint is valid

I have a table storing some settings, with columns setName nvarchar(), setValue sql_variant, setRule nvarchar(). The settings may have different value types (hence setValue as sql_variant), and each ...
valigi's user avatar
  • 11
0 votes
1 answer
22 views

External Constraints in CPLEX IDE

I have a list of constraints for a CPLEX model, in a file called "constraints.txt". I want to import "constraints.txt" into the "subject to {}" block of my CPLEX model, ...
Patrick R. McMullen's user avatar
0 votes
0 answers
13 views

How to use @default trait?

I am new to smithy. I have a smithy structure: namespace example structure Identity { @required name: String @default(30.0) age: Double } structure Address { @required ...
lakshmiravali rimmalapudi's user avatar
1 vote
1 answer
15 views

Error on function SetArcCostEvaluatorOfAllVehicles();

When I try to set the cost by the function below: routing.SetArcCostEvaluatorOfAllVehicles((i, j) => { return (int)distanciaMatriz[manager.IndexToNode(i), manager.IndexToNode(j)]...
Bruno Raphael Facundo's user avatar

1
2 3 4 5
178