Questions tagged [constraint-programming]

A constraint network is defined by a triplet , where X is a set of variables, C is a set of constraints, and D a domain for X (i.e. a mapping from variables to sets of values). The constraint satisfaction problem (CSP) is the question of deciding whether a constraint network has a solution or not.

Constraint programming is a form of declarative programming. Constraints specify the desired properties of a solution, not a sequence of steps to execute.

A constraint satisfaction problem (CSP) is defined by a triplet <X,C,D>, where X is a set of variables, C is a set of constraints, and D a domain for X (i.e. a mapping from variables to sets of values). A CSP is called consistent if it has a solution.

Constraint programming blends in naturally with logic programming, since logic programming can in fact be regarded as a special form of constraint programming, where the domain is the set of Herbrand terms. When constraint programming is hosted by a logic programming language, it is called constraint logic programming and abbreviated as CLP.

The notion CLP(X) is used to refer to constraint logic programming over the domain X. The following instances are of particular relevance:

  • CLP(FD): reasoning over integers (see )
  • CLP(B): reasoning over Boolean variables (see )
  • CLP(Q): reasoning over rational numbers (see )
  • CLP(R): reasoning over real numbers or an approximation (see ).

All widely used Prolog systems (see ) ship with several constraint solvers, which are available either as built-in predicates or provided by libraries.

More information:

https://en.wikipedia.org/wiki/Constraint_programming

763 questions
0
votes
1 answer

Choco Solver ICF constraint to define the standard deviation of an IntVar array within limit

Say, I am having an IntVar array int n = 10; IntVar[] x = VariableFactory.boundedArray("x", n, 0, 100, solver); I need to define a constraint that restricts the standard deviation(can be a number with decimal points) of this array less than a…
Nitu Chiring
  • 13
  • 1
  • 3
0
votes
1 answer

Choco Solver ICF constraint to define the distance between min and max variable in an array

I am having an array of Choco solver IntVar variables, say, X1, X2,...,Xn. I need to define a constraint which enforces the rule - the distance( absolute difference) value between the min and max variable should be less than a fixed value, say, 100…
Nitu Chiring
  • 13
  • 1
  • 3
0
votes
1 answer

How to define a product in Choco (CSP)

I am trying to model a tennis scheduling problem, as I explain in this post. I was lucky to get an answer with the equations describing the problem which allowed me to implement it in Choco, and it looks like it's working good enough. So what I am…
dabadaba
  • 9,064
  • 21
  • 85
  • 155
0
votes
1 answer

Modeling tennis matchups with Choco (CSP)

I am trying to model a problem with Choco to get the combinations of possible matchups in a tennis event (or any sport). The way I am trying to do it I have the following: // Set of timeslots when the event is held (i.e. 10am-10pm) int nTimeslots =…
dabadaba
  • 9,064
  • 21
  • 85
  • 155
0
votes
1 answer

CPLEX/OPL search phases without variable chooser

I have an OPL CP model in IBM ILOG CPLEX. It is possible only to set CP search phases with decision variable, variable chooser and value chooser. Somehow like that : execute { var f = cp.factory; var phase1 = f.searchPhase(slot, …
0
votes
1 answer

Linker Issues VS2015. LNK2019 and LNK2001 unresolved external symbol

I am trying to extend my knowledge of constrain programming and I want to build a simple example using google's or-tools in VS2015. However I am constantly nagged by those linker errors. LNK2019 and LNK2001. Why is linking in VS so darn…
0
votes
1 answer

resource allocation with penalties in choco

For my model I have about 120 people and 650 tasks. I now want to allocate those tasks with choco 3.3.3. For that I have a boolMatrix "assignment" 120x650 where there is a 1 if the task is assigned to the person and a 0 otherwise. But now I have to…
Dora
  • 47
  • 1
  • 8
0
votes
0 answers

Constraint Program: Build employee weekly schedules using ILOG

I'm new to constraint programming. Now I try to build weekly schedules to manage employee work time and to meet the labor demand. I am using ILOG CPLEX and try to fix the problem. I think this is an easy problem but I can't wrap my head around it.…
0
votes
1 answer

Having some difficulty implementing a 'generalized arc consistency' algorithm in Java

Here is the algorithm I am trying to implement in Java... (Didn't fully format correctly, so it may be easier to view it at this link, just scroll up half a page from where it brings you http://artint.info/html/ArtInt_79.html#AC-3-fig ) 1: procedure…
Badger
  • 301
  • 3
  • 15
0
votes
4 answers

Timetabling/Scheduling Library

I'm looking for a library to help me solve a constraint based logic problem where I need to schedule a number of different events of varying duration. The events have different attributes associated with them and my main issue is that I need to…
user461697
0
votes
1 answer

How can Minizinc be used to solve a weighted constraint satisfaction problem_?

Given a weighted constraint satisfaction problem (X, C, k) where X is a set of variables, C is a set of soft constraints and k > 0 is an integer or infinity; how can this be translated into a minizinc source file? Each constraint in C is a function…
0
votes
0 answers

Scheduling Problems (shift planning), need in a fast algorithm

i have a problem that i'll explain and i don't know if it is a scheduling problem : for 30 or 31 days/month we want to assign doctors to shifts with some constraints : 1-every doctor must be assigned to specific number of days (e.g 10 or…
0
votes
1 answer

How to model the allocation of vehicles for trips, possibly using Linear/Integer/Mixed math?

There are 10 bus routes in the city. 50 trips by the buses need to be made. We have 6 buses. We know that at any given point, no more than 6 trips run simultaneously. We need to allocate the 6 buses to the 50 trips such that utilization of the buses…
0
votes
1 answer

How many Terms/Variables/Constraints/Non-Zeroes I defined in my Solver Foundation model?

I'm using Microsoft Solver Foundation Express eddition in my program, Express version is limited in model size according this link. Is there any way to find how many: Terms Variables Constraints Non-Zeros I defined in my model, using code?
Masoud
  • 8,020
  • 12
  • 62
  • 123
0
votes
1 answer

Arrange blocks by 2D property without overlap

My app needs to show several buttons, without overlap, and preferably without scrolling or zooming. They must be big enough to poke with a finger and read the text. Button width depends on its text length, and the height is constant. The screen size…
Adrian May
  • 2,127
  • 15
  • 24