optaplanner

Optaplanner - availability of Vehicles

蓝咒 提交于 2019-12-06 07:24:40
I am working on a VRPTW problem where vehicles have availablity constraints. This means that they might not be available the entire period of a day - basically a time windows for vehicles. Is there a way to build this in optaplanner? Thank you and Brgds, Paul This following should work: add 2 fields (start and end) on (TimeWindowed)Vehicle in ArrivalTimeUpdatingVariableListener use at least the vehicle's start time before it leaves a depot add a hard constraint that the vehicle should be back at the depot by it's end time. Make sure to penalize not just -1, but instead, minus the amount of

OptaPlanner - The entity was never added to this ScoreDirector error

无人久伴 提交于 2019-12-06 02:36:18
I am implementing an algorithm similar to the NurseRoster one in OptaPlanner. I need to implement a rule in drools that check if the Employee cannot work more days than the number of days in his contract . Since i couldn't figure out how to make this in drools, i decided to write it as a method in a class, and then use it in drools to check if the constraint has been broken. Since i needed a List of ShiftAssignments in the Employee class, i needed to use an @InverseRelationShadowVariable that updated that list automatically an Employee got assigned to a Shift . Since my Employee now has to be

How do I use Drools Planner?

纵然是瞬间 提交于 2019-12-06 01:00:00
问题 I have a scheduling problem where each student expresses his preferences for a lecture and a course timetable is generated for all of the students at the same time (in a batch mode if I may). From what I read around and understand, Drools Planner is very well suited to solve this type of problem. I installed Drools and GEF into my Eclipse IDE. Everything loads just fine. Unfortunately, I can not figure out how to build a simple project. I looked online for references and found Drools Planner

Java常用的规则引擎,让你变动的代码更加容易维护

丶灬走出姿态 提交于 2019-12-05 10:51:26
概述 在本文中,我们将介绍Java中一些最受欢迎的规则引擎。 规则引擎简介 规则引擎由推理引擎发展而来,是一种嵌入在应用程序中的组件,实现了将业务决策从应用程序代码中分离出来,并使用预定义的语义模块编写业务决策。接受数据输入,解释业务规则,并根据业务规则做出业务决策。在Java中,大多数流行的规则引擎都实现JSR94 将规则引擎想象成一个以数据和规则作为输入的系统。它将这些规则应用于数据,并根据规则定义为我们提供输出。让我们以一个在线购物为例,我们希望为客户提供某些促销或折扣。 如果购物车总额超过$ 400,可为客户提供20%的折扣。 第一次下单给10%。 上面将购物车和客户定义为满足规则集中定义的条件的规则将在其中执行的数据。 规则引擎的优点 简化系统架构,优化应用 提高系统的可维护性 减少编写“硬代码”业务规则的成本和风险 应付特殊状况,即客户一开始没有提到要将业务逻辑考虑在内 过将规则引擎分开,它提供了更大的可重用性。 规则引擎场景 流程分支非常复杂,规则变量庞大 有不确定性的需求,变更频率较高 需要快速做出响应和决策 规则变更期望脱离于开发人员,脱离coding Java 中常用的开源规则引擎有哪些呢? Drools Drools是业务规则管理系统(BRMS)解决方案。它提供了核心业务规则引擎(BRE),Web UI和规则管理应用程序(Drools Workbench)

Exhaustive Search in OptaPlanner does not work on very simple example

我的未来我决定 提交于 2019-12-04 15:36:48
We are trying to create a simple example to test the capabilities of OptaPlanner. In the following we show what we came up with. The problem with our example is that when we are selecting an exhaustive search algorithm for solving the problem, OptaPlanner terminates quickly with the wrong answer, which is always zero, even if zero is not a possible solution available from the ValueRangeProvider. Furthermore the PlanningVariable is not set during solving, as opposed to when local search is used. We tried to change the algorithms in the examples that come with OptaPlanner (e.g. TSP), which

How do I use Drools Planner?

老子叫甜甜 提交于 2019-12-04 06:14:05
I have a scheduling problem where each student expresses his preferences for a lecture and a course timetable is generated for all of the students at the same time (in a batch mode if I may). From what I read around and understand, Drools Planner is very well suited to solve this type of problem. I installed Drools and GEF into my Eclipse IDE. Everything loads just fine. Unfortunately, I can not figure out how to build a simple project. I looked online for references and found Drools Planner examples, which look and work great. However, I did not find any good tutorial that walks people

Incremental score calculation bug?

蹲街弑〆低调 提交于 2019-12-03 20:57:16
I've been dealing with a score corruption error for few days with no apparent reason. The error appears only on FULL_ASSERT mode and it is not related to the constraints defined on the drools file. Following is the error : 014-07-02 14:51:49,037 [SwingWorker-pool-1-thread-4] TRACE Move index (0), score (-4/-2450/-240/-170), accepted (false) for move (EMP4@START => EMP2). java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Score corruption: the workingScore (-3/-1890/-640/-170) is not the uncorruptedScore (-3/-1890/-640/-250) after completedAction (EMP3@EMP4 => EMP4): The

Using Optaplanner to solve VRPTWPD

拟墨画扇 提交于 2019-12-03 04:30:38
问题 I'm new to optaplanner, and am hoping to use it to solve the VRPTW problem with pickups and deliveries (VRPTWPD). I started by taking the VRPTW code from the examples repo. I am trying to add to it to solve my problem. However, I'm unable to return a solution that honors the precedence/vehicle constraints (pickups must be done before deliveries, and both must be done by the same vehicle). I am consistently returning a solution where the hard score is what I would expect for such a solution (i

Using Optaplanner to solve VRPTWPD

纵然是瞬间 提交于 2019-12-02 17:42:19
I'm new to optaplanner, and am hoping to use it to solve the VRPTW problem with pickups and deliveries (VRPTWPD). I started by taking the VRPTW code from the examples repo. I am trying to add to it to solve my problem. However, I'm unable to return a solution that honors the precedence/vehicle constraints (pickups must be done before deliveries, and both must be done by the same vehicle). I am consistently returning a solution where the hard score is what I would expect for such a solution (i.e. I can add up all the violations in a small sample problem and see that the hard score matches the

VariableListener corruption

荒凉一梦 提交于 2019-12-02 03:56:27
I was playing around with the custom shadow variables and custom variable listeners. I found that the "Exam timetabling" example uses custom shadow variables to update "Following exams" when the "Leading Exam" changes. So what i did to assert asking in this question was true Custom VariableListener updating more than one shadow variables i added a second shadow variable in the Following Exam class which references the variable "period" , and then in the variable listener of the LeadingExam planning entity(PeriodUpdatingVariableListener) i update both the variables. Here is the code for the