暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

What's new in BlackStar APS Solver 1.3

真知科技 2021-08-09
368

为什么一个几十年历史的老牌APS在用户一个非常实际、非常细致的个性需求面前就失灵?


BlackStar作为具有高度抽象理念的全行业、精确时间的特种APS求解器,实际业务场景的复杂性和多变性是其核心关注点。


在版本1.3中,做了近年来最为重大的升级,就是为了满足场景和需求的多变性:



一、引入了扩展动作IAction机制。允许用户以极低代码量完成复杂的交互定制。动作支持初始setting和自身的状态变量variables。低代码的IAction可以通过动作注入的形式,由BlackStar App自动搜索并读入,并在可视化环境使用、试排、查看结果。


namespace BlackStar.Model.Interfaces
{
//
// Summary:
// Action interface for custom situations
public interface IAction
{
        // Summary:
// unchangeable settings during Action arrangements
Dictionary<string, object> Settings { get; set; }
//
// Summary:
// changeable variables of SampleCase during Action arrangements
Dictionary<string, object> Variables { get; set; }


//
// Summary:
// arrange the custom IAction using its own logic
//
// Parameters:
// caseLogOP:
// the logger of current samplecase
//
// dsSampleCase:
// the DataSetSampleCase the IAction takes affect
//
// settings:
// the settings of the IAction
//
// variables:
// the variables of the IAction
//
// startDt:
// start DateTime to arrange the IAction
void Arrange(SampleCaseLogOP caseLogOP, DataSetSampleCase dsSampleCase, Dictionary<string, object> settings, Dictionary<string, object> variables, DateTime startDt, string actionId, Guid guid);
}
}
复制


二、资源状态变量。允许通过SetVariable和GetVarible设置任意资源的任意状态,具体变量的种类、数量、名字完全视场景需求而定,BlackStar并不做限制。

                                // Summary:
// set a resource's variable to certain value
//
// Parameters:
// resource:
// resource code
//
// variable:
// variable name
//
// startDt:
// start time
//
// endDt:
// end time (later than start time)
public void SetVariable(string resource, string variable, string value, DateTime startDt, DateTime endDt);


//
// Summary:
// get the variable state of a resource
//
// Parameters:
// resource:
// resource code
//
// variable:
// variable name
//
// dt:
// desired DateTime
//
// Returns:
// Item1: the variable value Item2: the end time that it would last Item3: time
// point with next FactDataRow
public Tuple<string, DateTime, DateTime>? GetVariable(string resource, string variable, DateTime dt);
复制


三、依据资源状态变量试排资源需求。AlgorithmOP.TryConsume的新重载,除指定对资源需求清单外,还可指定资源的状态清单,表明特定动作仅在特定状态下安排。


//
// Summary:
// try to arrange a list of DecomposeConsume, requiring that a list of desired resource
// variable fulfilled 安排一组消耗(DecomposeConsume),并且同时满足一组资源变量符合要求
//
// Parameters:
// dsSampleCase:
// target dsSampleCase 目标的算例数据集
//
// deConsumes:
// list of required consume 消耗的集合
//
// desireVariables:
// list of desired variable 变量的集合
//
// dtBase:
// start DateTime for searching 搜索的开始时间
//
// postponeOption:
// search direction on time line: forward or backward时间顺移的方向:前向或后向
//
// maxPostpone:
// max postpone time duration最大顺移时间范围
//
// allowSwitch:
// all switch resource允许更换资源
//
// desireResource:
// a list of desired variable state 一组目标变量的描述:item1: resource code 资源代号 item2: variable
// name 变量名 item3: desired variable value 所需的变量值 item4: desired time duration for
// the variable remains desired value 所需变量的持续时间
//
// desireTarget:
// desired target code, "" if not specified 指定的目标,如果不指定请用""
//
// Returns:
// true if success, false if not 成功返回true,未成功返回false
public static bool TryConsumes(DataSetSampleCase dsSampleCase, List<DecomposeConsume> deConsumes, List<Tuple<string, string, string, TimeSpan>> desireVariables, ref DateTime dtBase, PostponeOption postponeOption, TimeSpan maxPostpone, bool allowSwitch, string desireResource, string desireTarget);
复制


如此,动作、资源都有了状态标记,再加上扩展动作注入、扩展规则注入,还有什么场景无法满足呢?



文章转载自真知科技,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论