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

Minizinc: is this constraint possible?

I'd like to figure out how to write this constraint: I have a list of exams,every exam has a duration; the final output is the display of a real timetable, in the columns there are the available hours, four in the morning and four in the afternoon,…
0
votes
1 answer

Get a list of variables in a Space in Gecode

Gecode uses Spaces to represent the constraint satisfaction problem in progress: each time a decision point is reached, the Space is copied. I want to perform analysis on these spaces in progress. Is there a way to obtain the list of variables,…
Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555
0
votes
1 answer

Minimum Delay Graph Algorithm

I need help regarding a graph problem. I'm looking for and existing solution or algorithm instead of implementing my own, If there is one, please help me out. I tried googling without success. My problem is: I have several locations to visit, and…
0
votes
1 answer

AIMMS: is it possible to minimize two variables together?

For a project of bike sharing simulation, I was asked to implement a constraint programming solver by AIMMS. As some of you know, AIMMS has a mathematical program where you have to specify which variable you want to be maximized or minimized, in…
SagittariusA
  • 5,289
  • 15
  • 73
  • 127
0
votes
1 answer

Generating unique solutions with Constraint Programming

I had a brief exposure to CP and MiniZinc but I'm no expert. I have a CP model, which I cannot post here ATM, implemented in MiniZinc. I need to generate all the feasible solution for the problem. We expect to have just a "few" ones, say less than…
a.tavs
  • 3
  • 1
0
votes
1 answer

Don't force variable allocation in Optaplanner

I tried to use optaplanner for the first time (quite straightforward by the way, help is very complete, and error message are very explicit). My problem is simple: allocate rooms to teams, depending on their size. I want to fill all the rooms, and I…
RandomCoder
  • 6,606
  • 6
  • 22
  • 28
0
votes
1 answer

is there a bug in my rollback system?

I have a set of unassigned variables and by branching and propagating I want to find the correct value assignments. When propagation fails, I'll branch back and undo the propagation. To undo the propagation, I use a commit/rollback system, where…
Albert Hendriks
  • 1,979
  • 3
  • 25
  • 45
0
votes
0 answers

Scheduling in choco

I have n tasks to be scheduled. The time horizon is 0..T periods. Each task consumes a resources when executed. A resources are limited and could be of different types. I use the following decision variables in choco 2.1.5: IntegerVariable[][] x =…
JackAW
  • 164
  • 2
  • 14
0
votes
1 answer

Choco Error: Initial Propagation: Contradiction due to

I use Choco and when I try to solve a model, I get the message: - Initial Propagation: Contradiction due to [48.89604359598426,4.0] What does that mean? I could not find it in documents.
padawan
  • 1,295
  • 1
  • 17
  • 45
0
votes
2 answers

seating constraint program prolog - symmetry

I am looking for guidance on why there are an even number of solutions to this problem: An eccentric has his own personal collection of wild animals that include a bear, a lion, a tiger, an elephant, a wolverine, a rhino and a dingo. These 7 animals…
CompilerSaysNo
  • 415
  • 3
  • 14
0
votes
1 answer

Optaplanner : Planning entity and Planning variable at the same time?

Using Optaplanner, is it possible to define a class to be a planning entity and planning variable at the same time ? Example : @PlanningEntity(difficultyComparatorClass = NodeDifficultyComparator.class) public class Node extends ProcessChain…
Jack Kass
  • 55
  • 9
0
votes
2 answers

Constraint in Choco

I've found a Choco solver as constraint programming software working with Java. I would like to learn it more. I have done some basic example. But now I would like to try something more complex (Pritsker project scheduling alg) and I need your help.…
JackAW
  • 164
  • 2
  • 14
0
votes
2 answers

MATLAB ga() ignoring user-supplied initial population

I am trying to solve an optimization problem using the MATLAB ga() function. I will try to be as brief as possible. It is basically a least-squares fitting problem, where I manipulate some inputs to try and match a target function. The problem has…
user1675006
0
votes
2 answers

How to process dependencies between tasks considering multiple constraints?

I'm working on a Java program that take an input file containing a bunch of depencencies between tasks like this : C --> D A --> B A --> D F --> G B --> C E --> F "C --> D" means that task D can only start after C is finished but doesn't…
0
votes
1 answer

MS Solver Foundation CSP Error - Inputs have different Symbol Domain

I am trying to use Microsoft Solver Foundation to solve our family Christmas draw (similar to a "secret santa" or "kris kringle"). I have some complex constraints (e.g can't buy for your siblings), which I have already used to prune the domains for…
Spongeboy
  • 2,232
  • 3
  • 28
  • 37