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

Using or constraint for RealVariables in Choco 2

I use Choco 2.1.5 with Eclipse IDE in Windows 8.1 When I compile the code below: CPModel m = new CPModel(); m.setDefaultExpressionDecomposition(false); RealVariable A = Choco.makeRealVar("a", -5.5, 5.5); RealVariable B = Choco.makeRealVar("b", -4.4,…
padawan
  • 1,295
  • 1
  • 17
  • 45
0
votes
1 answer

ExceptionInInitializerError in Choco 3

When I try to run the example in Choco's website: Solver solver = new Solver(); double PREC = 0.01d; // precision RealVar x = VariableFactory.real("x", -1.0d, 1.0d, PREC, solver); RealVar y = VariableFactory.real("y", -1.0d, 1.0d,…
padawan
  • 1,295
  • 1
  • 17
  • 45
0
votes
1 answer

Optimization with constraint programming

I want to express and solve below equations in a constraint programming language. I have variables t and trying to find best multipliers k which minimizes my objective function. Time: t1, t2, t3... given in input Multipler k1, k2, k3... (This is…
0
votes
1 answer

Magic Square Solver Using Constraint-Programming

I'm trying to do a custom magic square solver using constraint-programming in Python. For this I use python-constraint (http://labix.org/python-constraint). For this problem the definition of a magic square will be: "A magic square is an arrangement…
Zycho
  • 298
  • 3
  • 13
0
votes
0 answers

Minizinc soft constraint issue

i'm facing an issue with a Minizinc code that have to schedule some exams in available rooms and periods. I skip the entire problem and code, because i've just a problem in the definition of this soft constraint: some exams are targeted as…
0
votes
1 answer

Solving full anagrams with a dictionary

I am solving a classical problem. To be precise, I am trying to solve a full anagram. Any word or phrase that exactly reproduces the letters in another order is an anagram. I have an anagram, a dictionary and a hash. I need to come up with the…
0
votes
1 answer

Difference between Planning Reasoning and Constraint Solving

I'm new to this topic I'm currently sligtly confused about the differences between planning, constraint solving, and reasoning As far I understood planning is the identification of the right "things" to do. This can be done by following some…
0
votes
0 answers

Simplifying MiniZinc constraints

I would like to simplify a group of repetitive constraints that appear in a model. The aim is to ensure that a group of experts is staffed with a quantity of skills, each expert having 0..n skills. Currently, I have to repeat the constraint for each…
user1454590
  • 71
  • 1
  • 3
0
votes
1 answer

Modelling recipes and available ingredients with constraint logic

Imagine I have a number of recipes for different dishes and a larder containing various ingredients in my kitchen. I want to construct a model using core.logic which will enable me to answer the following question: for a given set of ingredients…
0
votes
1 answer

Constraint Programming over integer set variables

I am using GeCode to build a software for solving a specific task. I modeled my problem using integer set variables and some constraints over these variables. But for the matter of this question, let us consider a simpler case. Say I have three set…
Nightzus
  • 11
  • 1
0
votes
1 answer

Constraint choco

I am using choco API to solve a problem. What I need is coding a constraint that make the sum of all my variables equal to 1. This code keeps a sum of rows equal 1: IntegerVariable[][] rows; int n; //number of rows for(int i=0; i
HiddenDroid
  • 1,440
  • 4
  • 14
  • 27
0
votes
1 answer

Moving chained Planning Entities while solving time

In Optaplanner, is it possible to assign the same planning variable to different planning entities in a move (between score calculations)? For eg, when Customer A is assigned to a StandStill, Customer B will also be assigned to the same…
0
votes
1 answer

OPL operational research conditional constraints

Is there a workaround in order to express this model correctly: using CP; int fooSize[0..3]=[2,2,3,2]; dvar interval foo[t in 0..3] size fooSize[t]; dvar int bar[0..3] in 0..1; dexpr int stop = max(t in 0..3) endOf(foo[t]); minimize stop; subject…
Emilien
  • 2,385
  • 16
  • 24
0
votes
0 answers

number of inferred invalid tuples by existing constraints

I have been dealing with this problem for days but still no solution. Let me explain it on a simple example. Assume there is an array of integers with length 8. Every cell can take certain values. First 4 cells can take 0 or 1 and the other half…
genclik27
  • 323
  • 1
  • 7
  • 18
0
votes
1 answer

Microsoft Solver Foundation could not solve my model in some cases

I'm working on a production planning project, so I want to find an order production start time in some machines(A, B). For simplification purpose, I suppose that I have 2 machines(machine A and machine B) I have following constraints: Each machine…
Masoud
  • 8,020
  • 12
  • 62
  • 123