SDMP User Manual (ENG)
  • Introduction
    • Introduction to SDMP
  • Getting Started
    • Creating SDMP Project
  • Data Handling
    • Loading Input Data
      • Defining Input Data Schema
      • Creating Input Data
      • Loading Input Data
    • Retriving Data
    • Writing Output Data
      • Defining Output Data Schema
      • Adding Data Row
      • Writing to File
  • General Module
    • Overview
    • User Controls
      • StateControl
      • ActionControl
      • StateTransitionControl
      • BoundControl
      • ApproximationControl
      • SolverControl
      • EventControl
      • DataControl
      • LogControl
    • Data Model
      • State
      • StateActionMap
    • Example Problems
      • Car Resequencing Problem
      • Lot Sizing Problem
  • Routing Module
    • Overview
    • User Controls
      • CustomerControl
      • VehicleControl
    • Data Model
    • Example Problems
      • Vehicle Routing Problem
  • Scheduling Module
    • Overview
    • User Controls
    • Data Model
    • Example Problems
Powered by GitBook
On this page
  1. General Module
  2. User Controls

ActionControl

Controls for functions related to action

GetStateActionMaps

public virtual List<DataModel.StateActionMap> GetStateActionMaps(State state)

Definition

Defines a set of actions to consider in a given state.

Parameters

Type
Description

The state to define the actions.

Return

Type
Description
Default

List<StateActionMap>

The list of StateActionMap.

Empty List

Example

public override List<StateActionMap> GetStateActionMaps(State state)
{
    List<StateActionMap> maps = new List<StateActionMap>();
    CRPData data = DataManager.Instance.Data as CRPData;

    CRPState fromState = state as CRPState;
    Dictionary<int, CRPConveyor> stateInfo = fromState.StateInfo;

    CRPJob lastJob = fromState.LastRetrievedJob;

    for (int i = 1; i <= CRPParameter.CONV_NUM; i++)
    {
        CRPConveyor conv = stateInfo[i];

        if (conv.JobCount <= 0)
        {
            continue;
        }

        CRPState toState = new CRPState();
        toState.SetStateInfo(stateInfo);
        CRPJob toJob = toState.RetrieveJob(i);

        StateActionMap map = new StateActionMap();
        map.PreActionState = fromState;
        map.PostActionState = toState;

        double cost = 0;

        if (lastJob != null && lastJob.Color.ColorNumber != toJob.Color.ColorNumber)
            cost = 1;

        map.Cost = cost;

        if (toState.JobCount <= 0) 
        {
            toState.IsLastStage = true;
        }

        maps.Add(map);
    }

    return maps;
}
PreviousStateControlNextStateTransitionControl

Last updated 1 year ago

State