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;
    . . .
}

本文标签: