Questions tagged [python-constraint]
13 questions
                    
                    13
                    
            votes
                
                2 answers
            
        constraint satisfaction problem missing one constraint
I'm a lab practises tutor at the university, based on last year student comments, we wanted, my boss and I, to address them. My boss chose to go with writing a C script and I pick python (python-constraint) to try to resolve our problem.…
         
    
    
        Florian Bernard
        
- 2,561
- 1
- 9
- 22
                    2
                    
            votes
                
                0 answers
            
        Solving simultaneous linear and non-linear equations and inequalities
I have a number of linear and non-linear equations and inequalities (about twenty), and am looking for solutions to these. The equations either relate or constrain a number of variables. These variables are either constant, allowed to be within some…
         
    
    
        Heisenbugs
        
- 35
- 4
                    0
                    
            votes
                
                0 answers
            
        Cannot import name 'CSP' from library csp
I am executing the following code:
from typing import Dict,List,Optional
from csp import CSP
from constraint import Constraint
from typing import Dict,List,Optional
class QueensConstraint(Constraint[int,int]):
    def…
         
    
    
        Hamza Ali
        
- 3
- 2
                    0
                    
            votes
                
                0 answers
            
        How to look at multiple constraints together in python-constraint library
I have been practicing using the python constraint library by solving logic puzzles with it. I've found it an absolute joy to work with, but I'm stuck on a relatively simple puzzle.
I can solve it programatically, but the goal is to solve it using…
         
    
    
        hoshisabi
        
- 1
- 2
                    0
                    
            votes
                
                0 answers
            
        KeyError in python constraint in a csp scheduler problem
I need to build a csp scheduler that given a set of students with name,competence,disponibility and a set of tasks with name,competence_required,duration prints (or better show it in a graph) what task a student has to do. I'm at the beginning of…
         
    
    
        nicola luna
        
- 1
- 1
                    0
                    
            votes
                
                0 answers
            
        How to use python-constraint correclty
I tried the python-constraint library to solve a CSP problem, but I don't understand why I got 2048 solutions with a dataframe of 4 records.
My dataframe represents a set of distances from the closest elements to fountains in parks, and I use CSP to…
         
    
    
        Adil Blanco
        
- 616
- 2
- 6
- 23
                    0
                    
            votes
                
                0 answers
            
        Constraint problem doesn't handle some test cases
I have a python constraint problem like this:
You need to make a schedule for the presentation of papers for a conference. A total of 10 papers from several fields are to be presented at the conference: Artificial Intelligence (AI), Machine Learning…
         
    
    
        Бојан Василевски
        
- 3
- 3
                    0
                    
            votes
                
                0 answers
            
        Identify Graph nodes belonging to a clique (Max clique problem with Python constraints api)
I am trying to solve the max clique problem using Python's constraints api and I am planning to use the MIP-model, where there is a boolean for each n[i] node indicating if the node belongs (1 / true), or not (0 / false), to a clique.
The constraint…
         
    
    
        C96
        
- 477
- 8
- 33
                    0
                    
            votes
                
                1 answer
            
        Python-constraint variables that take their name instead of the value
I want to multiply the range of each variable because I can't use more than 5 kg and 50 euros so I multiply the weight of each product and its value but instead, the program returns me an error that it's taking the value an instead of the…
         
    
    
        Arévalo
        
- 1
                    0
                    
            votes
                
                0 answers
            
        How to program CSP bidimensional problem with python-constraint
I need to use python-constraint for solving a stowage problem. I have 2 different types of containers (standard S and refrigereted R) and two possible destinations. Containers must be stowed as shown in the next grid that
N N N N
N N N N
X E E X
X X…
         
    
    
        sergiohzlz
        
- 113
- 2
- 5
                    0
                    
            votes
                
                2 answers
            
        Problems with adding constraints in a loop
I have this:
import constraint
p = constraint.Problem()
t = [0,5]
c = [3,7]
s = range(len(t))
n = 12
p.addVariables([str(i) for i in s], range(n))
p.addConstraint(lambda x: (x+t[0])%n in c, ('0'))                             …
         
    
    
        klutt
        
- 30,332
- 17
- 55
- 95
                    0
                    
            votes
                
                0 answers
            
        Problem set up issues with python-constraint
I have a dataframe df and need to compute a column “res” by satisfying the conditions below -
elements of "res" have to be within the limit 0.5≤res≤4.5
sum (df.res*df.A)==1
orders of "res" have to be var1>var2>var3>……>var14 or df.order
I have…
         
    
    
        Jainul
        
- 1
- 2
                    0
                    
            votes
                
                0 answers
            
        Why the constraint cannot generate all possible combinations?
I am trying to generate all possible combinations under some constraints using the python-constraint. Here are the main() code:
list1 = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0]
list2…
         
    
    
        JJT
        
- 1