admin管理员组文章数量:1302381
The general constraint problem here is to schedule test events that have personnel. The personnel and the facility for scheduling the test event all have independent time availability. I have been able to get the following working successfully but need to extend the problem to "optional" personnel and personnel where [0..n] of a certain type may be required by a test event.
public class TestEvent
{
@PlanningId
private Long id;
private String name;
private int duration;
// Not yet making use of this - this makes the need for a test
// conductor "optional"
private boolean conductorRequired;
// Not yet making use of this - this makes support staff have
// a multiplicity of [0..n]
private int supportStaffRequiredCount;
}
@PlanningEntity
public Class TestEventAssignment
{
@PlanningId
private Long id;
@PlanningVariable
private TimeGrain startingTimeGrain;
private TestEvent testEvent;
// This works for a single conductor, I am able to write constraints
// to ensure the conductor is available at the same time the test
// event is scheduled in the testing facility
//
// Q1: Part of my question involves how to have this become 'optional'
// based on what the test event is demanding?
@PlanningVariable
private Conductor conductor;
// This is successfully working as coded.
// Q2: How do I transform this so that, based on the demands of the
// testEvent, this might need to have 0, or 1, or 2, . .?
@PlanningVariable
private SupportStaff supportStaff;
}
@PlanningSolution
public class Schedule {
@ProblemFactCollectionProperty
private List<TestEvent> testEventList;
@ValueRangeProvider
@ProblemFactCollectionProperty
private List<TimeGrain> testEnvironmentAvailability;
@ValueRangeProvider
@ProblemFactCollectionProperty
private List<Conductor> conductorList;
@ProblemFactCollectionProperty
private List<SilSupport> silSupportList;
@PlanningScore
private HardSoftScore score;
. . .
}
本文标签:
版权声明:本文标题:java - How to correctly construct an Optaplanner setup to handle an optional @PlanningVariable and a @PlanningVariable with a [0 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741682087a2392229.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论