So konstruieren Sie ein Optaplanner -Setup korrekt, um eine optionale @PlanningVariable und eine @PlanningVariable mit eJava

Java-Forum
Guest
 So konstruieren Sie ein Optaplanner -Setup korrekt, um eine optionale @PlanningVariable und eine @PlanningVariable mit e

Post by Guest »

Das allgemeine Einschränkungsproblem hier besteht darin, Testereignisse mit Personal zu planen. Das Personal und die Einrichtung zur Planung des Testereignisses haben alle unabhängige Zeitverfügbarkeit. Ich konnte das Folgende erfolgreich zum Arbeiten bringen, musste das Problem jedoch auf "optionales" Personal und Personal ausdehnen, wobei [0..n] eines bestimmten Typs durch ein Testereignis erforderlich sein kann. < /P>

Code: Select all

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 testEventList;
@ValueRangeProvider
@ProblemFactCollectionProperty
private List testEnvironmentAvailability;
@ValueRangeProvider
@ProblemFactCollectionProperty
private List conductorList;
@ProblemFactCollectionProperty
private List silSupportList;

@PlanningScore
private HardSoftScore score;
. . .
}

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post