Questions tagged [java]

For questions about solving Operations Research problems using the Java programming language.

Filter by
Sorted by
Tagged with
3 votes
1 answer
126 views

Efficient modelling via Gurobi

I would like to model the following constraint set in gurobi-java. \begin{equation} t^n_{ij} \geq t^n_{(i-1)j}+S_{(i-1)j} - (1 - \sum_{\substack{m \in \mathcal{M} \\ G_{ijm} = 1}}\sum_{k \in \mathcal{...
mdslt's user avatar
  • 575
6 votes
8 answers
3k views

Ideal programming language for an operations researcher

No single programming language will meet every need. However, there should be a language that most operations research scientists prefer to master. I have coded different algorithms in Matlab and ...
mdslt's user avatar
  • 575
2 votes
1 answer
278 views

CPLEX stuck in solve method - dual simplex solved model

I am solving a (rather large) MILP in CPLEX in Java. I also wrote a solution extractor method, which works most of the time. However, when CPLEX tries to solve my problem with the dual simplex method ...
Juul9191's user avatar
2 votes
0 answers
88 views

MIP start in cplex using Java

When I am reading an "lp" file for the problem and using a MIP start reading from a "sol" file it works. But when I pass on the same model directly to cplex (without writing lp) ...
Suman's user avatar
  • 21
2 votes
1 answer
197 views

RAM overflow when scheduling 1000+ intervals

Due to the answers to this and this questions, I was able to find the optimal solution for scheduling problem. However, if there are many tasks that must be scheduled, e.g. 1000+, then the solver ...
Artem Popov's user avatar
3 votes
1 answer
263 views

Force gaps between tasks, tasks are scheduled within their job's time windows in Jobshop problem

The problem I'm trying to solve is a modification of the original Jobshop problem. The additional constraints are: There is only one machine for all jobs and their tasks. Each job has a priority (...
Artem Popov's user avatar
0 votes
0 answers
72 views

Decision tree for a decision analysis to identify a strategy to reach a goal

I want to develop a script for a decision tree, which I already know its structure, like a flowchart in which each internal node represents a "test" on an attribute (e.g. whether a coin flip ...
Haider's user avatar
  • 11
1 vote
0 answers
133 views

Binary variable with two criteria in Gurobi (Java)

I have the following problem in Gurobi (Java). I have a binary variable $b$ that is supposed to be $1$ or $0$ depending on my optimisation variable $x$. It should be true that $b = 1$ if $c_1 \le x \...
Handballer73's user avatar
2 votes
1 answer
180 views

CPLEX Indicator Constraints in Java API

I'm using the Java API of CPLEX (12.6.1 version) to solve a MILP problem. This is how I create 'normal' constraints: ...
rainbow's user avatar
  • 307
0 votes
0 answers
53 views

linear equation with conditions in Java

I have the following problem: I want to determine a linear equation for a data table with $x$ and $y$ value. Point 1 should be the point where the first time $y > 0$ and point 2 should be the point ...
Handballer73's user avatar
4 votes
1 answer
535 views

how to implement an optimization function with polynomial in Gurobi (Java)

I have the following problem: I have an objective function with the optimization variable $x$, which looks simplified like this: $ZF = (a+b)*(x+1)$ Here $a$ is simply a constant value. However, behind ...
Handballer73's user avatar
0 votes
0 answers
64 views

Linear equation from pairs of values with conditions in Gurobi (Java)

How can I create a linear equation in Gurobi (Java) from values (x-y value pairs) that also has the following properties: $\forall x \leq 0 \Longrightarrow y = 0$ The linear line/equation should have ...
Handballer73's user avatar
0 votes
1 answer
474 views

if-else query depending on optimization variable in Gurobi (Java)

I am looking for the most elegant solution to the following problem: I have an if-else query that depends on my optimization variable $x_i$. If $a \leq b_i + x_i$, the parameter $c$ should take the ...
Handballer73's user avatar
2 votes
3 answers
164 views

Link a binary variable to continuous variable in Java Gurobi

I have the following problem: Depending on my continuous optimization variable $S_m$, I would like to introduce a binary variable $x_m$, which, depending on the value of $S_m$ (greater or less than 0) ...
Handballer73's user avatar
3 votes
1 answer
511 views

How do I learn and use optaplanner ? any detailed tutorials/videos available online apart from the ones in optaplanner website?

I have a beginners level knowledge in Java , I am trying to learn optaplanner , can anyone help me finding the right resources to learn optaplanner and spring/springboot integration ,since my ...
21vs's user avatar
  • 469
2 votes
1 answer
417 views

ALNS java code with the roulette-wheel-selection?

Currently I am coding the ALNS algorithm for the vehicle routing problem . I am stuck in the operator selection phase, I did not understand how I can apply this formula: $$p_i=\frac{f_i}{\sum_{j=1}^...
userB's user avatar
  • 133
5 votes
1 answer
82 views

Java in OR: Which non-constraint solving libraries do you use?

If you're programming OR challenges in Java, besides using constraint solvers, which other libraries do you typically use? Maybe for common tasks such as data reading, etc. Why? How do they make your ...
Geoffrey De Smet's user avatar
3 votes
1 answer
321 views

Implementation of Local Branching

I've been recently reading some papers where the authors use local branching specifically in Benders Decomposition (see for reference). Although I understand up to some extend how the algorithm works, ...
whitepanda's user avatar
3 votes
1 answer
117 views

How can I change decision variable type in Concert Technologies (with Java)

I have a MILP model with continuous variables ($y_{ij}$) and binaries ($x_{ij}$). I am using Java and cplex 12.8 for implementation. Is there a way by which - using the Java-cplex API - I would be ...
Jyotirmoy's user avatar
1 vote
0 answers
202 views

Fixed cost associated to SlackVar(waiting time cost) [CVRPTW]

I'm modeling a CVRPTW with some features: Each type of vehicle has a cost per km and a fixed cost per trip. To calculate these costs, I am using these methods for this: ...
Luiz Picanço's user avatar
7 votes
1 answer
1k views

Solution time out for VRPTW in or-tools

I am experimenting around with or-tools and somehow I can't get a solution for the VRPTW problem for any of the instances I have tested from Gehring & Homberger ...
k88's user avatar
  • 219
11 votes
1 answer
636 views

k-means/k-medoids Clustering Implementation in CPLEX Java

I am trying to model a grouping algorithm as k-means clustering problem, by referring to the general definition as mentioned in Wikipedia. In my system, I have $N$ nodes that I want to group in $m$ ...
Betty's user avatar
  • 534
7 votes
0 answers
76 views

Which Constraint solver is extensible to CSP algorithms?

I am novice to constraint programming and I need to implement the following algorithms. Backtacking Conflict-based backjumping AC partial lookahead MAC Forward checking Forward checking + dom ...
Cecelia's user avatar
  • 87
5 votes
0 answers
102 views

Understanding HardRouteConstraint

I am trying to understand the route constraints in jsprit. While I got the concept of HardActivityConstraint, I am unable to have clarity on HardRouteConstraint. Can someone, preferably with a simple ...
Aman Kumar's user avatar
8 votes
0 answers
115 views

Multiple shipments with FILO order

I am trying to solve a problem statement with the help of jsprit. There is a depot. Identical items need to be delivered or picked up. An item can have two states: Bad or good. Bad items need to be ...
Aman Kumar's user avatar
3 votes
2 answers
1k views

Find all Combinations of a Matrix

I have a $16\times11$ matrix and want to find all eligible* combinations of this matrix including always entities from all 11 columns. A simple example from a $2\times3$ matrix would be the following:...
Georgios's user avatar
  • 1,193
11 votes
2 answers
615 views

CPLEX Auto-Benders: How do I get the number of optimality and feasibility cuts?

I am using CPLEX's 12.9 auto-Benders decomposition feature (from the CPLEX Java API). Following the documentation I let CPLEX decide the decomposition strategy as ...
k88074's user avatar
  • 1,641
7 votes
2 answers
278 views

CPLEX CP Optimizer Java API function missing

I can not seem to find the needed functions to model the following problem through the Java API (CP Optimizer): a machine that has downtime and sequence-dependent setup times, with the extra ...
Maarten's user avatar
  • 295
7 votes
1 answer
331 views

Program can't stop when using callback of usercut in CPLEX to solve a branch-and-cut problem

When I tried to use Java to call CPLEX and use callback functions to solve a VRP problem with branch-and-cut, some problems emerged. I took out the subtour elimination constraint from the original ...
xin koala's user avatar
9 votes
4 answers
3k views

Solving MIP in Java with free software

I would like to solve mixed integer programs in Java. I need an approach that relies purely on software that is free (not only for academic use, but also for people outside academia). What would be ...
J Fabian Meier's user avatar
7 votes
1 answer
533 views

Java source code for branch and price

Is there any Java source code (or framework) to implement and solve MILP using the branch and price method? AFAIK, jORLib is a framework to implement B&P using Java, but it does not have any ...
A.Omidi's user avatar
  • 8,380