Class KSchedule


  • public class KSchedule
    extends java.lang.Object
    Scheduling and planning problems are concerned with determining a plan for
    the execution of a given set of tasks.

    The objective may be to generate a feasible schedule that satisfies the given
    constraints (such as sequence of tasks or limited resource availability) or
    to optimize a given criterion such as the makespan of the schedule.

    Artelys-Kalis defines several aggregate modeling objects to simplify the
    formulation of standard scheduling problems like tasks,resources and schedule
    objects. by the types KUnaryResource and KDiscreteResource. When working with
    these scheduling objects it is often sufficient to state the objects and
    their properties, such as task duration or resource use; the necessary
    constraint relations are set up automatically by Artelys-Kalis (referred to
    as implicit constraints).

    Since:
    2016.1
    • Field Detail

      • swigCMemOwn

        protected transient boolean swigCMemOwn
    • Constructor Detail

      • KSchedule

        protected KSchedule​(long cPtr,
                            boolean cMemoryOwn)
      • KSchedule

        public KSchedule​(KProblem p,
                         java.lang.String name,
                         int timeMin,
                         int timeMax)
        Constructor

        Parameters:
        p - the kalis problem
        name - the name of this schedule
        timeMin - minimal time horizon
        timeMax - maximal time horizon
    • Method Detail

      • getCPtr

        protected static long getCPtr​(KSchedule obj)
      • finalize

        protected void finalize()
        Overrides:
        finalize in class java.lang.Object
      • delete

        public void delete()
      • print

        public void print()
        Pretty printing of the schedule
      • print

        public void print​(com.artelys.kalis.SWIGTYPE_p_void ctx,
                          com.artelys.kalis.SWIGTYPE_p_f_p_void_p_q_const__char__int pfp)
        Pretty printing of the schedule
      • addTask

        public void addTask​(KTask task)
        Add a task to this schedule
      • addResource

        public void addResource​(KResource resource)
        Add a resource to this schedule

        Parameters:
        resource - the resource to add to this schedule
      • getProblem

        public KProblem getProblem()
        Return the problem associated to this schedule
      • printRessourcesGantt

        public void printRessourcesGantt​(KSolution sol,
                                         int factor)
        Pretty printing of the solution of this schedule
      • setFirstSolutionSearchStrategy

        public void setFirstSolutionSearchStrategy​(KBranchingSchemeArray branchingSchemeArray)
      • setOptimalSolutionSearchStrategy

        public void setOptimalSolutionSearchStrategy​(KBranchingSchemeArray branchingSchemeArray)
      • getStartDatesArray

        public KIntVarArray getStartDatesArray()
        Return a pointer to the start dates array of all the tasks in this schedule
      • getEndDatesArray

        public KIntVarArray getEndDatesArray()
        Return a pointer to the end dates array of all the tasks in this schedule
      • getDurationsArray

        public KIntVarArray getDurationsArray()
        Return a pointer to the durations array of all the tasks in this schedule
      • getResourceArray

        public KResourceArray getResourceArray()
        Return a pointer to the list of resource of this schedule
      • getTaskArray

        public KTaskArray getTaskArray()
        Return a pointer to the list of tasks of this schedule
      • getTimeMin

        public int getTimeMin()
        Return the minimal time horizon of this schedule
      • getTimeMax

        public int getTimeMax()
        Return the maximal time horizon of this schedule
      • setTimeMin

        public void setTimeMin​(int timemin)
        Setting the minimal horizon timestep
      • setTimeMax

        public void setTimeMax​(int timemax)
        Setting the maxiaml horizon timestep
      • optimize

        public int optimize()
        Launch the optimization phase
      • findInitialSolution

        public int findInitialSolution()
        Find a initial heuristic solution for this schedule

        Return Inconsistent if this schedule has no solution.
        Return Suboptimal if the heuristic solution is subobtimal.
        Return Optimal if the heuristic solution is optimal.
      • findOptimalSolution

        public int findOptimalSolution()
        Find the optimal solution for this schedule

        Return Inconsistent if this schedule has no solution.
        Return Optimal if the heuristic solution is optimal
      • localOptimization

        public int localOptimization()
        Find suboptimal solutions for this schedule using a local search algorithm.

        Return Inconsistent if this schedule has no solution.
        Return Suboptimal if the heuristic solution is suboptimal.
      • setObjective

        public void setObjective​(KFloatVar obj)
        Set the objective variable for this schedule as a KFloatVar

        Parameters:
        obj - the objective variable for this schedule as a KFloatVar
      • setObjective

        public void setObjective​(KIntVar obj)
        Set the objective variable for this schedule as a KIntVar

      • getObjective

        public KNumVar getObjective()
        Return a reference to the objective variable of this schedule
      • getMakeSpan

        public KIntVar getMakeSpan()
        Return a reference to the objective variable representing the makespan of this schedule
      • close

        public void close()
        Close this schedule (no tasks or resources can be added after this
      • computeLowerBounds

        public boolean computeLowerBounds()
      • setFunctionPointers

        public void setFunctionPointers​(com.artelys.kalis.SWIGTYPE_p_f_p_void__int asyncfunc,
                                        com.artelys.kalis.SWIGTYPE_p_f_p_void__int sol,
                                        com.artelys.kalis.SWIGTYPE_p_f_p_void__int nodes,
                                        com.artelys.kalis.SWIGTYPE_p_f_p_void__int goup,
                                        com.artelys.kalis.SWIGTYPE_p_f_p_void__int godown,
                                        com.artelys.kalis.SWIGTYPE_p_void param)
        Set the callback functions to call when the schedule is optimized

        Parameters:
        asyncfunc - the callback to call to stop the optimization process
        sol - the callback to call when a solution has been found
        nodes - the callback to call when a node is created
        goup - the callback to call when a branch has been fully explored
        godown - the callback to call when a branch is explored
      • getSolver

        public KSolver getSolver()
        Return the solver object used to optimize the schedule
      • getNumberOfTasks

        public int getNumberOfTasks()
        Return the number of tasks in this schedule
      • getTask

        public KTask getTask​(int nbTask)
        Return a pointer to the task number 'nbTask" in the input order
      • getNumberOfResources

        public int getNumberOfResources()
        Return the number of resources in this schedule
      • getResource

        public KResource getResource​(int nbResource)
        Return a pointer to the resource number 'nbResource' in this schedule in the input order
      • getIntAttrib

        public int getIntAttrib​(int attribute)
        Return the value of an int attribute

        Parameters:
        attribute - integer attribute to retrieve

        See Also:
        IntAttrib
      • getDblAttrib

        public double getDblAttrib​(int attribute)
        Return the value of a double attribute

        Parameters:
        attribute - double attribute to retrieve

        See Also:
        DblAttrib
      • setIntAttrib

        public void setIntAttrib​(int attribute,
                                 int value)
        Set the value of an int attribute of the solver

        Parameters:
        attribute - the int attribute to set
        value - the value of the attribute

        See Also:
        IntAttrib
      • setDblAttrib

        public void setDblAttrib​(int attribute,
                                 double value)
        Set the value of a double attribute

        Parameters:
        attribute - the double attribute to set
        value - value of the attribute

        See Also:
        DblAttrib
      • getIntControl

        public int getIntControl​(int control)
        Return the value of an int control

        Parameters:
        control - integer control to retrieve

        See Also:
        IntControl
      • getDblControl

        public double getDblControl​(int control)
        Return the value of a double control

        Parameters:
        control - double control to retrieve

        See Also:
        DblControl
      • setIntControl

        public void setIntControl​(int control,
                                  int value)
        Set the value of an int control of the solver

        Parameters:
        control - the int control to set
        value - the value of the control

        See Also:
        IntControl
      • setDblControl

        public void setDblControl​(int control,
                                  double value)
        Set the value of a double control

        Parameters:
        control - the double control to set
        value - value of the control

        See Also:
        DblControl
      • addRelaxationSolver

        public void addRelaxationSolver​(KLinearRelaxationSolver solver)
        Add a relaxation solver to be used during the resolution process
      • getFirstTask

        public com.artelys.kalis.SWIGTYPE_p_void getFirstTask()
      • getNextTask

        public com.artelys.kalis.SWIGTYPE_p_void getNextTask()
      • getFirstResource

        public com.artelys.kalis.SWIGTYPE_p_void getFirstResource()
      • getNextResource

        public com.artelys.kalis.SWIGTYPE_p_void getNextResource()
      • isClosed

        public boolean isClosed()
        Return true if the schedule is closed
      • getSchedule_IPtr

        public com.artelys.kalis.SWIGTYPE_p_KSchedule_I getSchedule_IPtr()
      • getParallelSchedule_IPtr

        public com.artelys.kalis.SWIGTYPE_p_KParallelSchedule_I getParallelSchedule_IPtr()
      • getInstance

        public KSchedule getInstance​(long pb)