Questions tagged [clp]

Constraint logic programming is a programming paradigm that combines features of logic programming and constraint programming. As in regular logic programming, programs are queried about the provability of a goal, which may contain constraints in addition to literals.

67 questions
2
votes
1 answer

Different ways of computing list length in Prolog

Here are 4 different ways of computing list length in Prolog: :- use_module(library(clpz)). list_length1([], 0). list_length1([_|T], N) :- N #> 0, N1 #= N - 1, list_length1(T, N1). list_length2(A, N) :- N #>= 0, …
vasily
  • 2,850
  • 1
  • 24
  • 40
2
votes
1 answer

How can I display the results of an SWI-Prolog program in a table? (CLP problem)

I am trying to solve a CLP problem in SWI-Prolog. The task is very similar to the zebra problem. There are a total of 25 variables with the domains between 1 to 5. So the related variables will get the same tags. (The program is written in…
9511
  • 33
  • 3
2
votes
1 answer

Mercury Constraint Solving

I know a little Prolog, and frequently use CLP(FD) etc. This paper (written in 2006, apparently) indicates that Mercury now has constraint solving, too. I've found a few mentions of it in the Library Reference Manual. However, I can't find how to…
Erhannis
  • 4,256
  • 4
  • 34
  • 48
2
votes
1 answer

CLP: Efficient model of 'not three same values'

I need to model this (simple) constraint in Eclipse CLP: Given three domain variables, lets say D1, D2, and D3 and I want to ensure that these three variables will not end up with the same value. Two of them can have equal value. Version 1 My first…
Jan Drozen
  • 894
  • 2
  • 12
  • 28
2
votes
1 answer

SWI Prolog CLP(FD) scheduling

I am solving a scheduling task in SWI Prolog using the CLPFD library. Since it is the first time I solve something more serious than was the sendmory I probably need some good advices from more experienced users. Let me briefly describe the…
Jan Drozen
  • 894
  • 2
  • 12
  • 28
2
votes
1 answer

How to interface Prolog CLP(R) with real vectors?

I'm using Prolog to solve simple geometrical equations. For example, I can define all points p3 on a line passing trough two points p1 and p2 as: line((X1, Y1, Z1), (X2, Y2, Z2), T, (X3, Y3, Z3)) :- {(X2 - X1) * T = X3}, {(Y2 -…
yawn
  • 422
  • 1
  • 5
  • 21
2
votes
3 answers

SWI: Constraint : list of maximum of N elements in domain D?

I can assign a domain of possible values to a variable i.e. : ?- X in 1..3, X #= 3. X = 3. Is there a way to add a constraint so that a variable can accept a list of values in a specified domain ? What about a constraint to a list of maximum 3…
sten
  • 7,028
  • 9
  • 41
  • 63
2
votes
0 answers

CLP libraries issue while configuring the Optic Planner

I am facing CLP issue while configuring the optic planner. Please suggest how to overcome this issue. Here is the issue: arunkumar@arunkumar:~/Desktop/lwm2m_project_/planner/optic$ ./run-cmake-debug CMake Warning (dev) at optic/UseDoxygen.cmake:85…
Arun
  • 21
  • 1
2
votes
1 answer

LP DSL for F# with Clp as solver

Since the Microsoft Solver Foundation has been deprecated, I am trying to find an alternative or a reasonable way to create my own DSL. What I am looking for is essential a DSL to describe a LP in F#, solve it with Clp and evaluate the…
Chronos
  • 153
  • 4
1
vote
0 answers

Team scheduling program stuck at a certain level

I am trying to make a scheduling program of a football tournament, There are 6 groups with 5 teams each Each team will play 4 games, 2 home 2 away match there are no more than three matches on any day each team has at least 4 rest days between…
1
vote
0 answers

What's backquote meaning in upf writed by tcl?

I'm seeing upf src code, but I meet the backquote before create_power_domain. I don't understand what's backquote meaning in follow code.(the code is used by clp) ` create_power_domain CORE -elements {.} I have searched in tcl lan, but I couldn't…
mhhai
  • 31
  • 3
1
vote
1 answer

constrain list length in CLP (Prolog)

I have an optimisation problem, where I want to minimse the length of a list which I have yet to construct. Language here is Prolog, using swipl's clpfd library. Something along the lines of pred(L), length(L,N), labeling([min(N)],[....]). Problem…
fledermaus
  • 33
  • 3
1
vote
3 answers

DB2 CLP passing variable in .sql file

As my shell script is calling Db2 many times with an ultra long SQL statement, I would like to abstract the SQL statements from the script and put them into a .sql file, then run it from the Db2 command line processor db2 -f xxx.sql. I want some of…
kurumi megumi
  • 11
  • 1
  • 3
1
vote
1 answer

Prolog: Scheduling Start times with an additional constraint

In an assignment for uni , I've been asked to create a schedule for hypothetical backup represented by the predicate backup/5 The first argument is the server type with values : db , web The second argument is the server name the third argument…
1
vote
0 answers

how can i change the lower bound using JuMP 0.19

I have a variable x where its lower bound was defined as lb=zeros(3), after that I want to change for each element of lb to be equal element of an array like c=[1;2;1] what I want exactly is to make lb[i]=c[i] for i=1:length(c) I used to do this in…
Marouane1994
  • 534
  • 3
  • 11