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

Repeating the matched models in Z3py

In the following working example , I'm trying to retrieve the matched models, in this case there are two satisfying models: t1= cl7 t2= cl4 t3= cl5 and t1= cl4 t2= cl3 t3= cl9 The problem is repeating the matched…
0
votes
2 answers

Maximize number of assigned variables in constraint satisfaction

What are some known algorithms (or resources to find algorithms) to find the assignment that maximizes the number of assigned variables in a constraint satisfaction problem (in case no satisfying assignment is present)?
0
votes
1 answer

Java Constraints Library (JCL) problem: how to represent addition?

I have to solve a CSP logic problem using Java Constraints Library. For now I've managed to represent some constraints of the problem, most of them are based on "equals" and "not equals" binary constraints. My doubt is, how to represent an addition…
fjsj
  • 10,995
  • 11
  • 41
  • 57
0
votes
1 answer

Eclipse Constraint Programming - search/6

I'm having trouble understanding this documentation for the search/6 function in the eclipse constraint programming framework. I understand that the choice parameter basically affects the value ordering. It also seems like the selection method…
NickHalden
  • 1,469
  • 2
  • 20
  • 31
-1
votes
1 answer

Model infeasible when fixing some variables in OrTools CP-SAT

I have a boolean variable in Ortools CP-SAT, let's say x. That variable is in a constraint say y = -5 * x. I have two other constraints in the model that are model.Add(y >= 0).OnlyEnforceIf(z) and model.Add(y < 0).OnlyEnforceIf(z.Not()). When I try…
-1
votes
1 answer

Which algorithm for my scheduling problem with multiple criteria

I am looking for some guidance on making an algorithm. My scenario is described below. Scenario I have N teams and M rooms and want to create a weekly schedule that suits all the N teams based on some criteria. Each of the N teams looks as…
bragi
  • 183
  • 2
  • 12
-1
votes
1 answer

Is there a tool to visualize a tree search in ORtools?

I am conceiving a global constraint with the ORtools solver, and to have a better understanding of my algorithm's behavior, i want to visualize the tree search generated by the solver. So Is there any tool to visualize an ORtools tree search ?
-1
votes
1 answer

Modifying Python N-Queen program to show all possible solution instead of just one

I've found a code that uses Constraints module to create a N-Queen problem solver. My goal with it is to make it show all of the possible solutions, instead of just one it currently shows. I am asking for instructions and explanation, if possible,…
-1
votes
1 answer

Solve Stable Marriages Problem using constraint programming - BoundedLinearExpression object is not iterable

I'm taking a course on Discrete Optimization, and we're working through constraint programming. In a topic about reification, we're working through the Stable Marriages Problem (SPM). The model formulation is enum Men = [George, Hugh, Will,…
azizj
  • 3,428
  • 2
  • 25
  • 33
-1
votes
1 answer

Why does a soft constraint violation seem to prevent a feasible solution?

I have the following 2 constraints in my project: fun cpMustUseN(constraintFactory: ConstraintFactory): Constraint { return constraintFactory.forEach(MealMenu::class.java) .join(CpMustUse::class.java, equal({ mm ->…
Chris
  • 366
  • 3
  • 11
-1
votes
1 answer

Effective constraint solvers and optimizers

I would like to know which would be the best constraint solvers (commercial or open source) designed to handle complex optimization problems of several tens of thousands of variables and several thousand constraints, and why? Ideally, a solver…
-1
votes
1 answer

How can I get the cartesian product of a set of intervals with no overlapping?

given a dictionary with a set of intervals: intervals = {'561801/03/08': [[1081, 1156], [1141, 1216], [1201, 1276], [1741, 1816], [1801, 1876], [1861, 1936], [1921, 1996], [1981, 2056], [2041, 2116]], '563301/03/08': [[1170, 1250], [1230, 1310],…
-1
votes
1 answer

Demand optimization planning using PULP

Need help in solving a demand-optimiztion planning for factories. Factories have Machines which can make one or more Products in it. Each Product takes time to make 1 unit which is known as 'Cycle-Time'. So, to make 10 units of product/component on…
-1
votes
2 answers

Java lang NoSuchMethodError : SwigDirector for cplex

For my first attemp to use CP Optimizer with java, when i run my program i get this error message : Exception in thread "main" java.lang.NoSuchMethodError: SwigDirector_IloIntValueEvalWrapper_eval at…
-1
votes
1 answer

Java Constraint Programming

How do I express a quadratic objective function in Constraint Programming? In Cplex, I write it as follows: IloLQNumExpr objfn = model.lqNumExpr() but it is not the same in CP.
Ridvan
  • 13
  • 1
1 2 3
50
51