无法获得流程输出c#

时间:2016-09-24 14:08:26

标签: c#

在尝试读取新生成的流程输出时,我遇到了无法解释的行为 -

这是我正在使用的代码:

    p.StartInfo.Arguments += "-o Kd.pddl -f Kp.pddl";        
    StreamWriter planeWriter = new StreamWriter(m_planStream);
    p.StartInfo.UseShellExecute = false;
    p.StartInfo.RedirectStandardOutput = true;
    p.OutputDataReceived += new DataReceivedEventHandler(OutputHandler);
    p.OutputDataReceived += (sender, args) => planeWriter.WriteLine(args.Data);
    p.Start();

    p.BeginOutputReadLine();
    p.WaitForExit();
    m_planStream.Position = 0;
    StreamReader planReader = new StreamReader(m_planStream);
    m_sFFOutput = planReader.ReadToEnd();
    List<string> lPlan = new List<string>();
    Console.WriteLine(m_sFFOutput); 

这是非常简单的,对于大多数输出​​它都有效,这就是为什么我说这是无法解释的原因。

我每次使用不同的输入(Kd.pddl和K​​p.pddl)加载程序。 对于某些输入,它的工作正常,但对于某些输入,我根本无法获得任何输出。 在任何情况下都有输出,因为我也手动运行它,对于具有不同输出的不同输入,我能够检索输出。

即使我坚持并且错误参与论证 - 我得到程序输出。

可以对此使用一些见解,我对C#很新。

输出示例我无法检索(通过手动运行程序获得此项目):

ff: parsing domain file
domain 'KTRIANGLE_TIREWORLD_POMDP' defined
 ... done.
ff: parsing problem file
problem 'KTRIANGLE_TIREWORLD_INST_POMDP__1' defined
 ... done.



Cueing down from goal distance:    3 into depth [1]
                                   2            [1]
                                   1            [1]
                                   0

ff: found legal plan as follows

step    0: MOVE_CAR__LA1A1_LA1A2
        1: MOVE_CAR__LA1A2_LA1A3
        2: CHANGETIRE


time spent:    0.00 seconds instantiating 44 easy, 0 hard action templates
               0.00 seconds reachability analysis, yielding 19 facts and 44 actions
               0.00 seconds creating final representation with 18 relevant facts
               0.00 seconds building connectivity graph
               0.00 seconds searching, evaluating 4 states, to a max depth of 1
               0.00 seconds total time

当我贴一个随机字母来破坏参数时,我得到了这个输出,我能够检索它:

usage of ff:

OPTIONS   DESCRIPTIONS

-p <str>    path for operator and fact file
-o <str>    operator file name
-f <str>    fact file name

-i <num>    run-time information level( preset: 1 )
      0     only times
      1     problem name, planning process infos
    101     parsed problem data
    102     cleaned up ADL problem
    103     collected string tables
    104     encoded domain
    105     predicates inertia info
    106     splitted initial state
    107     domain with Wff s normalized
    108     domain with NOT conds translated
    109     splitted domain
    110     cleaned up easy domain
    111     unaries encoded easy domain
    112     effects multiplied easy domain
    113     inertia removed easy domain
    114     easy action templates
    115     cleaned up hard domain representation
    116     mixed hard domain representation
    117     final hard domain representation
    118     reachability analysis results
    119     facts selected as relevant
    120     final domain and problem representations
    121     connectivity graph
    122     fixpoint result on each evaluated state
    123     1P extracted on each evaluated state
    124     H set collected for each evaluated state
    125     False sets of goals <GAM>
    126     detected ordering constraints leq_h <GAM>
    127     the Goal Agenda <GAM>

-d <num>    switch on debugging

1 个答案:

答案 0 :(得分:1)

在阅读planWriter之前,您需要刷新m_planStream