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

My question is about Resource constraint Project Scheduling Problem code in cplex. I am trying to apply Preemption to it

I am working on RCPSP and want to apply Preemption to it. I have divided the duration of every task into equal parts. Now after doing that I am unable to apply Precedence constraints to each of individual unit duration of a task. using CP; int…
0
votes
1 answer

Julia - Constraint Programming in JuMP

I know we can use CPLEX in Julia JuMP, for linear programming for instance. But can we use CPLEX in JuMP, Julia v1.1 for constraint programming ? CPLEX and OPL can do constraint programming, but what about Julia, are there documentation pages in…
JKHA
  • 1,800
  • 11
  • 28
0
votes
1 answer

guide me to write a capacity constraint

I am trying to add few more constraint with existing  resource constraint project scheduling problem available OPL examples. Here I am attaching the example files of RCPSP problem. At present in this example problem I can start as many tasks as…
Kumar J
  • 50
  • 3
0
votes
1 answer

Modeling a constraint using Choco Solver

i want to model the following constraint in CHOCO. Any help please //cSelected[i]=1 ==> ∀ j∈{1,…,i-1} xCategory[i]!= xCategory[j] cSelected[i]=0, otherwise this is what i am trying to do int[] x = new int[]{0, 1, 0, 0,…
letraitre
  • 3
  • 2
0
votes
4 answers

Cross world puzzle solver using constraint library

I have this problem to solve that is shown in the picture. i have tried the code given below # -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ from constraint import * problem =…
Ali Yar Khan
  • 1,231
  • 2
  • 11
  • 33
0
votes
0 answers

Constrained MySQL database table rows

I constrained the user id, user email address & user name columns in mysql database to have unique values. However, when I added an account with a particular email address & later on deleted it. I have failed to edit/add another account with the…
0
votes
1 answer

MiniZinc find the set of int

I have a script in minizinc that tries to find the set of int, but is unable to do so. The problem statement is given a set of 2 class features, minimal support set needs to be found with constraints that its length should be less than some k, and…
user10635606
0
votes
0 answers

Effect of penalty cost value in optimization problems

I have an optimization problem where I attempt to minimize a project cost, typically valued at $100 million to $ 5 Billion. I am using COBYLA available part of Scipy package in Python 2.7. newsol =…
0
votes
2 answers

MiniZinc: Obtain a super set of array of sets

I am working on a constraint programming problem but stuck at a specific step and need suggestions. My data has a bunch of orders with each order having some SKUs. I want to group these orders in different batches and then count unique SKUs in a…
0
votes
1 answer

Modelling constraints in Choco solver

I'm playing around with choco solver to solve some task scheduling problems. I have several jobs and possible slots (where a job can be executed). There are some constraints like: There could only one job per slot (C.1) A job needs a certain time t…
Indivon
  • 1,784
  • 2
  • 17
  • 32
0
votes
0 answers

Minizinc error:model inconsistency detected

I'm developing a MiniZinc model for the traveling repairman problem and I'm obtaining the error of model inconsistency detected. I not really keen on modelling with Minizinc and I don't understand the reason of the problem. I would be grateful for…
0
votes
1 answer

Sets of equalities and inequalities constraint satisfiability problem

I am relatively new to CSPs and I am trying to find the value of all the variables from their respective domains, based on ==, >, < and != constraints imposed between the variables. I looked at Choco and Jacop but, I couldn't find out more about…
0
votes
2 answers

Issues with using IloCP with too many workers

I have built a simple constraint enforcing that the value of a variable must be consistent with a modulo operation. Two consistency levels are available: bounds consistency and domain consistency. In this example, solving the problem with bounds…
0
votes
1 answer

CP - OPL slicing input array

I think I need some help with the OPL language :/ My code is the following: using CP; int NbMchs = ...; range Mchs = 0..NbMchs-1; tuple Mode { int opId; int mch; int pt; }; {Mode} Modes = ...; // Not Working... int test[m in Mchs] = …
Greg K.
  • 686
  • 1
  • 5
  • 18
0
votes
2 answers

Employee scheduling using Google or-tools

I am a newbie to google or tools and currently i am working on an employee scheduling problem. the problem have a constraint that, as per the footfall of the shift, employees are assigned to the shifts. each employee is ranked from 1-n, and are…