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
4 answers

Algorithm for resolving conflicts with overlapping choices

I have a computational problem where I have a set of tags that can be given away exactly once, and a number of items that each have a set of possible choices of tags that they can accept. I need to assign the tags in such a way that each item gets a…
lyschoening
  • 18,170
  • 11
  • 44
  • 54
0
votes
1 answer

How can I define a constraint that prevents a resource to be allocated to 2 tasks that overlap?

How can I define a constraint that prevents a resource to be allocated to 2 tasks that overlap? I have defined 5 resources: R1,R2,...,R5 and 3 tasks: T1,T2,T3 that have their corresponding start and end date(s1, e1 represent the start and end date…
Nico A
  • 161
  • 1
  • 1
  • 6
0
votes
1 answer

Solving equations as CSP

I have a set of equations. I also have a set of values and the results for the equation. Something like: a + b + c = x and some allocation might be: 1 + 1 + 1 = 3 2 + 3 + 4 = 9 However, the actual equations are much longer and may contain some…
Mene
  • 3,739
  • 21
  • 40
0
votes
0 answers

SQL constraints using JPA

I have a data object (Data) and two kinds of key objects (KeyA and KeyB). I need to work with a record which is a pair key-data, i.e. ({KeyA|KeyB}, Data). Every key has to be mapped to exactly one data object and vice-versa. The question is how can…
j.l.
  • 71
  • 1
  • 1
  • 7
0
votes
1 answer

Does Z3py support Linear Temporal logic LTL?

Does Z3py support Linear Temporal logic LTL? If yes, can you provide an example of simple explain.
0
votes
1 answer

Differences between inference method and search method in constraint programming

To solve a constraint problem, we can use inference method and/or search method. Constraint Propagation. Christian Bessiere, 2006 states in the very beginning: Constraint propagation is a form of inference, not search. From my understanding, the…
Robin
  • 134
  • 9
0
votes
3 answers

Generating random instances of binary Constraint Satisfaction Problems

I'm implementing a generator of random CSPs for doing comparative testing of two different arc-consistency algorithms (AC3 and AC2001). The instances are generated with the parameters of number of variables, domains' size 8same for all variables),…
0
votes
2 answers

Using trigonometric functions in eclipse clp

I'm new to eclipse CLP and I want to implement a predicate that gets all the angles equivalent to a specific sinusoidal function, something like :- lib(ic). solve(L) :- L = [X,Y,Z], L::[-180..180], cos(X) #= sin(Y) + sin(Z), labeling(L). I know…
Poka Yoke
  • 373
  • 3
  • 8
  • 27
0
votes
1 answer

logistics of large conference scheduling

I have to schedule a conference, there is 6 class everyday and more than 10 lecturer,for 14days. some lecturer are available some days, some are not, some prefer some specific day or classess and some days they are off i googled it so much but…
Mohammad Hossein Amri
  • 1,842
  • 2
  • 23
  • 43
0
votes
2 answers

Does the SMT-Lib standard support the combination of theories?

I know that several works are trying to deal with the combination of theories in SMT. However, the SMT-Lib 2.0 language (http://smtlib.cs.uiowa.edu/docs.html) doesn't say anything regarding this point. My question is whether it supports that, and…
Med
  • 176
  • 7
0
votes
1 answer

Algorithm - Creating an exam schedule

I have a problem of creating an exam schedule based on three factors: rooms, courses, and days. There are a set number of rooms r, courses c, and days d where each day has three slots. There is also a set of students and a mapping from students to…
0
votes
1 answer

ValueError: Need more than 2123 values

I am trying to run a very large Z3 python program, as the following sample: S, (cl_3,cl_39,cl_11, me_32,m_59,m_81 …………) = EnumSort('S',['cl_3','cl_39','cl_11','me_32','me_59','me_81', …………..]) ######################################### def…
0
votes
1 answer

retrieve the matched model in Z3py?

In the following working example , How to retrieve the matched model? S, (cl_3,cl_39,cl_11, me_32,m_59,m_81) = EnumSort('S', ['cl_3','cl_39','cl_11','me_32','me_59','me_81']) h1, h2 = Consts('h1 h2', S) def fun(h1 ,…
0
votes
1 answer

How can i have more than 255 arguments in Z3py function?

I would like to kindly ask , how to have more than 255 arguments in the Z3 Python function h1, h2 = Consts('h1 h2', S) def fun(h1 , h2): return Or( And( h1 == cl_4712, h2 == me_1935), And( h1 == cl_1871, h2 == me_1935), …
0
votes
1 answer

z3py installation

I am having trouble getting z3 to work with Python. I am running Windows 7 64bit. I have downloaded 64bit Python 3.3.0 and 64bit z3 4.3.0. I have updated my PATH and PYTHONPATH to include the z3 \bin directory. However, when I try to use z3 in…