817 questions
0
votes
0
answers
78
views
How to minimize passenger ride time in OR-Tools Vehicle Routing Problem for school bus?
I'm working on a Vehicle Routing Problem using Google OR-Tools where I want to minimize ride time for passengers as part of the optimization objective.
Context
AM routes: Pick up kids from houses → ...
2
votes
1
answer
163
views
How to enforce per-passenger maximum ride time as a soft constraint in OR-Tools VRP?
I’m working on a Vehicle Routing Problem using Google OR-Tools.
The context is that each “customer” (or passenger) has to be picked up and eventually delivered to a common destination (for example, a ...
0
votes
2
answers
159
views
Using Add_implications in CP-SAT solver (google OR Tools)
I'm working on learning to use CP solver in ortools. I've built a test problem that attempts to locate feasible options for placing dogs that don't get along in cages so incompatible pairs are not ...
2
votes
1
answer
85
views
Suggestion needed for enhancing problem formulation for constraint programming
I'm trying to formulize a constraint programming solution for item allocation on shelf. The goal is simple items belonging to same brand should be kept as close as possible and should maintain a ...
2
votes
1
answer
214
views
Getting Infeasibility while solving constraint programming for shelf space allocation problem
I'm trying to allocate shelf space to items on planogram using constraint programming. It is a big problem and I'm trying to implement piece by piece. At first we're just trying to place items on ...
0
votes
0
answers
172
views
CP-SAT: normalization for multi-objective optimization
I'm working on a multi-objective optimization problem using CP-SAT, where I combine several objectives into a single objective using a weighted sum approach. All my objective terms are positive-valued,...
1
vote
1
answer
142
views
Optimize load balancing using a constraint solver
I'm trying to solve a load balancing problem with a constraint solver. I have a list of partitions, each one is associated with a load, and I want to assign these partitions to a fixed number of ...
0
votes
1
answer
111
views
Slow performance with simple constraint programming model
Im pretty new in the world of CP. Currently Im trying to solved a single machine scheduling problem with changeovers.
Here is my code and model:
from ortools.sat.python import cp_model
import random
#...
3
votes
1
answer
220
views
Sicstus CLPFD labeling time discrepancy
I was using Sicstus Prolog to solve Advent of Code 2024 Day 13, and I came across a surprising discrepancy in labeling times between different instances of the same constraint model. I have:
minCost(...
0
votes
0
answers
68
views
How to properly enforce consecutive time slot constraints in a constraint programming timetable software?
Problem Description
I am trying to add a constraint to my scheduling optimization problem to ensure that generated timetables have consecutive hours (i.e., no gaps between time slots within a day). ...
0
votes
1
answer
84
views
Is defining a problem in SMT-LIB language considered a form of constraint programming?
I've been exploring SMT solvers and the SMT-LIB standard, which provides a declarative language for defining problems in terms of logical formulas and constraints. My understanding is that SMT solvers ...
0
votes
1
answer
106
views
Adding a division constraint in Ortools results in MODEL_INVALID model when the nominator is a linear expression of two variables
I am trying to use google CP-SAT solver, version 9.11.4210 in a project. Part of the problem includes dividing a sum of two variables with another variable but the solver returns MODEL_INVALID. I have ...
0
votes
1
answer
117
views
Ortools can not evaluate LinearExpr edge case
I encounter a specific edge case in a CP model. All my variables are int based but the objective which is float based.
In a lot of usage of my model, there is no issue doing this. But in one specific ...
0
votes
1
answer
68
views
How can we assign the tasks of the same type into the task packages as much as possible with ortools cp-sat?
In labs, tasks can be assigned into task packages and then the packages are assigned to lab analysts.
Typically we want to:
Minimize the number of packages formed
Try our best to put the tasks of the ...
0
votes
1
answer
169
views
How can we achieve prioritization of tasks with OR-Tools?
I have two tasks to plan for the next two days in the shopfloor.
There is only one operator in the shopfloor and this operator can do only one task a day in these two days.
The tasks are of different ...
1
vote
2
answers
107
views
How to Sort an array on descending order with minizinc
In minizinc there is an inbuild sort function to sort a 1d array which sorts the elements by their ascending order. How do I do the opposite? I could not find a function directly associated with it. ...
1
vote
0
answers
53
views
How to identify and print which constraints are violated in OptaPy?
I'm working on a scheduling optimization project using OptaPy, where I've defined several hard and soft constraints like room conflicts, teacher conflicts, student group conflicts, etc. The problem ...
1
vote
3
answers
184
views
Suggestion on which constraint to adds to optimize Minizinc's model
I've recently started using Minizinc to solve this simple problem:
Problem definition:
I have grid of dimensions H and W of boolean variables. The only constraint is that if a variable is false then ...
1
vote
1
answer
60
views
CP Optimizer: Subtracting time-dependent value from cumul Function with minValue 0
in a CP model (simplified version of Laborie et al. 2018) I have a cumulFunction rUsage indicating the material demand along time, derived by the demand rate dmdR of a present interval variable:
dvar ...
0
votes
1
answer
88
views
Is there a bug in the "TransitiveClosure" function of Z3-Solver?
Here's the code of a simple example using TransitiveClosure.
from z3 import *
def compute_transitive_closure(graph):
num_nodes = len(graph)
# Create a Z3 context
ctx = Context()
# ...
0
votes
1
answer
62
views
CP Optimizer: Provide Initial Value for State Function
in my CP model I have a state function
stateFunction f(a in aRange) with TransitionTimes[a]
By default, the value of f[a] equals -1 until time 0, e.g.
id,value
1,stepwise{ -1 -> 0; 1 -> 3; -1 -&...
-1
votes
1
answer
203
views
Minzinc does not return optimal solution
Main question
Context: I specified an ILP encoding like the following:
<some preceding constraints bounding all variables in the objective term>
constraint <objective term> >= c;
...
0
votes
0
answers
111
views
or tools flexible job shop intervals with multiple machines and per machine availability per job
I have been looking at OR-tools flexible job shop examples, specifically around machine jobs with per job durations. I see examples for this base problem problems but not for a way to specify specific ...
1
vote
1
answer
113
views
I want to build a z3 solver that prints the range instead of printing all possible values
Suppose I have an expression x as an integer. So minimum and maximum value of that integer would be INT_MIN and INT_MAX if I don't apply any constraint. But suppose I apply a constraint a such that a ...
0
votes
1
answer
306
views
When does the CP-SAT Solver use CP-Solving and when SAT-Solving?
I have succesfully used the Google OR Tools to solve a complex matching problem.
However I want to know how the solver really works. Are there any public essays or books which explain the CP-SAT ...
-1
votes
1
answer
87
views
What is the correct way to rewrite a programme from CPLEX to CP? [closed]
I solve the problem of placing factories and warehouses at the same time. At first I wrote a programme using the standard CPLEX tools, but then I was faced with the task of rewriting this programme ...
1
vote
1
answer
339
views
OR-Tools CP-SAT Job Shop Scheduling - grouping tasks from different jobs
I am trying to build a schedule using Google OR-TOOLS CP-SAT. I found a problem, because there is requirement, that some of the tasks from different jobs should be scheduled one after another, if they ...
1
vote
2
answers
134
views
Unbound expression when using constraint programming (CPLEX)
I am coding the model using CP based on the paper "A Constraint Programming Approach to Electric Vehicle Routing with Time Windows" by Kyle.E.C.Booth
using CP;
int NoDepot = ...;
int ...
1
vote
1
answer
1k
views
OR-Tools library, CP-SAT Solver. With a large number of workers (num_search_workers), model calculation does not stop after calling stop_search
I'm solving a standard job shop scheduling problem. The launch occurs through an airflow in docker container.
Here are the machine parameters:
CPU: Intel Xeon Gold 6230
RAM: more than 300 GB
When ...
0
votes
1
answer
122
views
Search the minimum number of swaps to order an array in minizinc
I'm following a course in constraint programming and the professor assigned me this job:
Let us consider a n element vector of numbers v = [v_1, ... , v_n], where v_i ∈ N. For i, j ∈ {1, ... , n}
a ...
1
vote
1
answer
79
views
python-constraint not solving the n-queens puzzle
I'm using the python-constraint library to try to solve the n-queens problem
(n queens are placed on an n-by-n board and they must be arranged in such a way that they don't menace each other)
My ...
1
vote
2
answers
329
views
OR-Tools CP-SAT conditional constraint
In the problem I am trying to solve, I have a list of length n of boolean variables called x. Given an integer m where m < n, I need to define these two constraints:
if LinearExpr.Sum(x[m:]) > ...
1
vote
1
answer
953
views
OR-TOOLS Job Shop Scheduling - splitting longer tasks and keeping them together between shifts
Using OR-TOOLS CP-SAT I found a problem with intruding tasks between other tasks. In my model there are machines working on 1,2,3 shifts and not working on weekends.
#intervals for non-working time ...
1
vote
1
answer
79
views
A seeming cp/sat discrepancy in Picat (maximum flow)
I'm trying to modify maxflow modeling from A User’s Guide to Picat. I have two versions, flow1 and flow2, as follows:
import cp,util.
main =>
V = [1, 2, 3, 4, 5, 6, 7, 8],
E = [{1, 2}, {1, ...
1
vote
1
answer
38
views
How to catch `solve` failure in Picat?
I have a predicate that contains a solve call. It throws *** error(failed,main/0) when it has no solution. Is it possible to catch this error? Reading through the example file exs.pi I thought the ...
1
vote
1
answer
65
views
Is there a constraint to pieces of the stateFunction only go in ascending or descending order?
I have 3 intervals:
dvar interval MyInterval[0..2];
And I have state function
stateFunction MyStateFunction;
And I have constraints:
alwysConstant(MyStateFunction, MyInterval[i]);
alwyasIn(...
0
votes
1
answer
101
views
Is it possible for "alwaysIn" (state functions) select from set of values?
State functions looks like the best option for modeling my situation.
The image as it is now
Now interval variable X might be in range of state functin from 'vmin' to 'vmax'.
But in my situation any ...
0
votes
1
answer
153
views
Bin packing in OR-Tools with only one bin
I've been trying to adapt the bin-packing problem often seen in OR-Tools to optimize space used instead of optimizing number of bins, but I don't seem to be able to sort out how to do it.
So what I ...
0
votes
2
answers
99
views
System solution in [0,1]
I have a system of equation like bellow:
"L3 + L4 + S5 + S12 + L1 + D4 + L8 + S3 + L7 + D8 + D5 + L5 == 1",
"L4 + D9 + S5 + L1 + D16 + L8 + L6 + S8 + L7 + D8 == 1",
"L4 + L1 + ...
1
vote
1
answer
147
views
How to find the best possible team lineup (in swimming)
I currently have a fairly simple algorithm that tries to build the best possible team-lineup given some constrains:
There is a finite list of events which needs to be filled with swimmers
Event 1: 50 ...
0
votes
0
answers
103
views
python-constraint - schedule maker program does not follow constraints when sum is 0 or 2?
I am trying to create a program that create a schedule automatically based on 6 stores needs and 34 employee's availabilities. I am using python-constraint model to model the problem.
I wrote 2 ...
0
votes
1
answer
137
views
How do you encode a required number of consecutive days off in a set time-span constraint into an OR-Tools CP-SAT Schedule?
I'm developing a system that generates a roster for an air ambulance, and obviously these rosters are highly constrained and have loads of rules on how much time off a pilot should have. One of these ...
0
votes
1
answer
77
views
Error with DOCplex CP objective function expression
I am trying to replicate a CPLEX ILOG objective function in DOcplex but keep running into some errors. I am not too sure on how the type_of_next function() works with indexing, making it difficult for ...
0
votes
1
answer
42
views
Constraint Progrraming No solution
Hello everyone ı have an mathematical which is related with unrelated parallel machines with considering setup time between jobs and machine eligilibity. I wrote my mathematical model in GAMS. It ...
0
votes
1
answer
78
views
How to integrate OptaPlanner
I'm working on a node.js project for a timetable platform where professors can input preferences. Need help a tool (ex. integrating optaplanner ) to solve complex constraint programming issues ...
0
votes
1
answer
36
views
Error for pulse part in IBM CPLEX cumulative
Constraint progrraming in IBM CPLEX ILOG:
The code for the following Cumulative(Zi|i ∈ I, Resiv, ARv) ∀v ∈ V
I wrote in IBM CPLEX. However I got error for the pulse part. Can you help me guys.
forall(...
0
votes
1
answer
180
views
MIP (mixed integer problem) Build Constraint with OR
I have an MIP where I want to assign at least two variables (binary) from the same location.
How to implement the or in this case. I want something like this:
x1 + x2 + x3 + x4 >= 2 or
x5 + x6 + x7 ...
0
votes
1
answer
103
views
Constraint programming
I try to code my scheduling problem in IBM CPLEX ILOG. Here I get an error
The function noOverlap does not exist according to picture
Can you help me with this?
fo
int N=...;
int M=...;
int R=...; ...
0
votes
1
answer
176
views
Performance Issue with CPMpy's Cumulative Constraint
I'm facing a performance issue using cpmpy's cumulative constraint with the ortools solver. Despite a reasonable number of tasks, performance degrades unexpectedly. Is this a bug, or is there a better ...
0
votes
1
answer
126
views
I can't resolve a sudoku with OptaPlanner
I love constraint programming. I've been studying and modeling in other frameworks and I recently discovered OptaPlanner. I thought I had mastered it because I was able to model a few problems, even ...