locked
Exception - Update() schedule has a constant statement: (Migrated from community.research.microsoft.com) RRS feed

  • Question

  • Ravi Pandya posted on 08-13-2010 9:21 AM

    I'm getting the following error when generating code for my model, and I'm not sure what I should do to fix it - do you have any suggestions? Thanks,

    Ravi

    MicrosoftResearch.Transforms.TransformFailedException was unhandled
      Message=SchedulingTransform failed with 2 error(s) and 0 warning(s):
    Error in the application.
      Internal: Update() schedule has a constant statement: for(int observations = 0; observations<observationCount; observations++)
    {
        if (perturbationsApplied[observations]==1)
        {
            vdouble115_uses_B[observations][0] = GaussianProductVmpOp.AAverageLogarithm(rnaSteadyState1_observations_cond_model_1_B[observations], perturbationLevel[observations][perturbed[observations][vint34]]);
        }
    }
     in
    for(int observations = 0; observations<observationCount; observations++)
    {
        if (perturbationsApplied[observations]==1)
        {
            vdouble115_uses_B[observations][0] = GaussianProductVmpOp.AAverageLogarithm(rnaSteadyState1_observations_cond_model_1_B[observations], perturbationLevel[observations][perturbed[observations][vint34]]);
        }
    }

    Error in the application.
      Internal: Update() schedule has a constant statement: for(int observations = 0; observations<observationCount; observations++)
    {
        if (perturbationsApplied[observations]==1)
        {
            vdouble109_uses_B[observations][0] = GaussianProductVmpOp.AAverageLogarithm(rnaSteadyState1_observations_cond_model_0_B[observations], perturbationLevel[observations][perturbed[observations][vint30]]);
        }
    }
     in
    for(int observations = 0; observations<observationCount; observations++)
    {
        if (perturbationsApplied[observations]==1)
        {
            vdouble109_uses_B[observations][0] = GaussianProductVmpOp.AAverageLogarithm(rnaSteadyState1_observations_cond_model_0_B[observations], perturbationLevel[observations][perturbed[observations][vint30]]);
        }
    }


      Source=Infer.Compiler
      StackTrace:
           at MicrosoftResearch.Transforms.TransformResults.ThrowIfErrors(String msg, Boolean treatWarningsAsErrors) in C:\infernetBuilds\12-11-2009_17-18\Compiler\TransformFramework\TransformResults.cs:line 80
           at MicrosoftResearch.Transforms.TransformResults.ThrowIfErrors(String msg) in C:\infernetBuilds\12-11-2009_17-18\Compiler\TransformFramework\TransformResults.cs:line 70
           at MicrosoftResearch.Transforms.TransformerChain.TransformToDeclaration(ITypeDeclaration itd, AttributeRegistry`2 inputAttributes) in C:\infernetBuilds\12-11-2009_17-18\Compiler\TransformFramework\TransformerChain.cs:line 80
           at MicrosoftResearch.Infer.ModelCompiler.CompileWithoutParams(ITypeDeclaration itd, MethodBase method, AttributeRegistry`2 inputAttributes) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\ModelCompiler.cs:line 252
           at MicrosoftResearch.Infer.Models.ModelBuilder.Compile(InferenceEngine engine, Boolean checkParamsAreSet) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\Models\ModelBuilder.cs:line 186
           at MicrosoftResearch.Infer.InferenceEngine.GetCompiledInferenceAlgorithm(IEnumerable`1 vars, Boolean checkParamsAreSet, Boolean inferOnlySpecifiedVars) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\InferenceEngine.cs:line 402
           at MicrosoftResearch.Infer.InferenceEngine.InferAll(Boolean inferOnlySpecifiedVars, IEnumerable`1 vars) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\InferenceEngine.cs:line 346
           at MicrosoftResearch.Infer.InferenceEngine.Infer(IVariable var) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\InferenceEngine.cs:line 131
           at MicrosoftResearch.Infer.InferenceEngine.Infer[TReturn](IVariable var) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\InferenceEngine.cs:line 194
           at Stitch.Model.Infer(SteadyStateObservation[] observations) in C:\Users\ravip\Documents\Extreme\Dream\Stitch\Stitch\Model.cs:line 462
           at Test.Program.Main(String[] args) in C:\Users\ravip\Documents\Extreme\Dream\Stitch\Test\Program.cs:line 91
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException:

    Friday, June 3, 2011 5:58 PM

Answers

  • Ravi Pandya replied on 08-15-2010 2:28 PM

    Normal 0 false false false EN-US X-NONE X-NONE

    Thanks, that line actually did have an error – it was using the wrong index. But I still get the same error after fixing it. I think the relevant model code is:

     

            using (Variable.IfNot(model))

            {

    ...

                using (Variable.ForEach(observations))

                {

                    rnaLevel[vertex][observations] =

                        rnaEquilibrium[vertex]*

                        expressionModification[vertex][observations] *

                        combinedPerturbation[observations, Variable.Constant(vertex)];

                }

    ...

            }

            using (Variable.If(model))

            {

    ...

                using (Variable.ForEach(observations))

                {

                    rnaLevel[edge.To][observations] =

                        (rnaEquilibrium[edge.To]*

                        expressionModification[edge.To][observations] *

                        combinedPerturbation[observations, Variable.Constant(edge.To)])*

                        (rnaLevel[edge.From][observations]*

                        edgeInfluence[Variable.Constant(edgeIndex)]);

                 }

    ...

            }

     

    vertex & edge.To are both ints equal to 1 here,

    vdouble113 is the highlighted expression according to the factor graph

    rnaEquilibrium is a Gaussian Variable<double>[]

    expressionModification is an observed VariableArray<double>[]

    combinedPerturbation is defined by:

     

                affected[perturbations, vertices] =

                    Variable.Bernoulli(parameters.PerturbationAffectProbability).ForEach(perturbations, vertices)

                    .Named("affectedDistribution");

     

                using (Variable.ForEach(perturbations))

                {

                    using (Variable.ForEach(vertices))

                    {

                        using (Variable.If(affected[perturbations, vertices]))

                        {

                            perturbation[perturbations, vertices] =

                                Variable.GaussianFromMeanAndVariance(parameters.PerturbationMean, parameters.PerturbationVariance)

                                .Named("perturbationGaussian");

                        }

                        using (Variable.IfNot(affected[perturbations, vertices]))

                        {

                            perturbation[perturbations, vertices] =

                                Variable.GaussianFromMeanAndVariance(1.0, 0.0)

                                .Named("perturbationConstant");

                        }

                    }

                }

     

                using (Variable.ForEach(observations))

                {

                    using (Variable.Case(perturbationsApplied[observations], 0))

                    {

                        using (Variable.ForEach(vertices))

                        {

                            combinedPerturbation[observations, vertices] = Variable.Constant(1.0);

                        }

                    }

                    using (Variable.Case(perturbationsApplied[observations], 1))

                    {

                        var zero = Variable.Constant(0).Named("zero");

                        using (Variable.ForEach(vertices))

                        {

                            combinedPerturbation[observations, vertices] =

                                perturbation[perturbed[observations][zero], vertices] *

                                perturbationLevel[observations][zero];

                        }

                    }

                }

     

    The exception is:

     

    MicrosoftResearch.Transforms.TransformFailedException was unhandled

      Message=SchedulingTransform failed with 1 error(s) and 0 warning(s):

    Error in the application.

      Internal: Update() schedule has a constant statement: for(int observations = 0; observations<observationCount; observations++)

    {

                vdouble113_uses_B[observations][0] = GaussianProductVmpOp.AAverageLogarithm(rnaLevel1_observations_cond_model_1_B[observations], combinedPerturbation[observations, vint25]);

    }

     in

    for(int observations = 0; observations<observationCount; observations++)

    {

                vdouble113_uses_B[observations][0] = GaussianProductVmpOp.AAverageLogarithm(rnaLevel1_observations_cond_model_1_B[observations], combinedPerturbation[observations, vint25]);

    }

     

     

      Source=Infer.Compiler

      StackTrace:

           at MicrosoftResearch.Transforms.TransformResults.ThrowIfErrors(String msg, Boolean treatWarningsAsErrors) in C:\infernetBuilds\12-11-2009_17-18\Compiler\TransformFramework\TransformResults.cs:line 80

           at MicrosoftResearch.Transforms.TransformResults.ThrowIfErrors(String msg) in C:\infernetBuilds\12-11-2009_17-18\Compiler\TransformFramework\TransformResults.cs:line 70

           at MicrosoftResearch.Transforms.TransformerChain.TransformToDeclaration(ITypeDeclaration itd, AttributeRegistry`2 inputAttributes) in C:\infernetBuilds\12-11-2009_17-18\Compiler\TransformFramework\TransformerChain.cs:line 80

           at MicrosoftResearch.Infer.ModelCompiler.CompileWithoutParams(ITypeDeclaration itd, MethodBase method, AttributeRegistry`2 inputAttributes) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\ModelCompiler.cs:line 252

           at MicrosoftResearch.Infer.Models.ModelBuilder.Compile(InferenceEngine engine, Boolean checkParamsAreSet) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\Models\ModelBuilder.cs:line 186

           at MicrosoftResearch.Infer.InferenceEngine.GetCompiledInferenceAlgorithm(IEnumerable`1 vars, Boolean checkParamsAreSet, Boolean inferOnlySpecifiedVars) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\InferenceEngine.cs:line 402

           at MicrosoftResearch.Infer.InferenceEngine.InferAll(Boolean inferOnlySpecifiedVars, IEnumerable`1 vars) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\InferenceEngine.cs:line 346

           at MicrosoftResearch.Infer.InferenceEngine.Infer(IVariable var) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\InferenceEngine.cs:line 131

           at MicrosoftResearch.Infer.InferenceEngine.Infer[TReturn](IVariable var) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\InferenceEngine.cs:line 194

           at Stitch.Model.Infer(Observation[] observations, Double edgeInfluenceMean) in C:\Users\ravip\Documents\Extreme\Dream\Stitch\Stitch\Model.cs:line 575

           at Test.Program.Main(String[] args) in C:\Users\ravip\Documents\Extreme\Dream\Stitch\Test\Program.cs:line 106

           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)

           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)

           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

           at System.Threading.ThreadHelper.ThreadStart()

      InnerException:  

     

    Ravi

    Friday, June 3, 2011 5:59 PM

All replies

  • minka replied on 08-15-2010 9:10 AM

    My guess is that the expression perturbationLevel[observations][perturbed[observations][vint34]] is causing the problem.  Could you post the part of the model that created this expression?

    Friday, June 3, 2011 5:59 PM
  • Ravi Pandya replied on 08-15-2010 2:28 PM

    Normal 0 false false false EN-US X-NONE X-NONE

    Thanks, that line actually did have an error – it was using the wrong index. But I still get the same error after fixing it. I think the relevant model code is:

     

            using (Variable.IfNot(model))

            {

    ...

                using (Variable.ForEach(observations))

                {

                    rnaLevel[vertex][observations] =

                        rnaEquilibrium[vertex]*

                        expressionModification[vertex][observations] *

                        combinedPerturbation[observations, Variable.Constant(vertex)];

                }

    ...

            }

            using (Variable.If(model))

            {

    ...

                using (Variable.ForEach(observations))

                {

                    rnaLevel[edge.To][observations] =

                        (rnaEquilibrium[edge.To]*

                        expressionModification[edge.To][observations] *

                        combinedPerturbation[observations, Variable.Constant(edge.To)])*

                        (rnaLevel[edge.From][observations]*

                        edgeInfluence[Variable.Constant(edgeIndex)]);

                 }

    ...

            }

     

    vertex & edge.To are both ints equal to 1 here,

    vdouble113 is the highlighted expression according to the factor graph

    rnaEquilibrium is a Gaussian Variable<double>[]

    expressionModification is an observed VariableArray<double>[]

    combinedPerturbation is defined by:

     

                affected[perturbations, vertices] =

                    Variable.Bernoulli(parameters.PerturbationAffectProbability).ForEach(perturbations, vertices)

                    .Named("affectedDistribution");

     

                using (Variable.ForEach(perturbations))

                {

                    using (Variable.ForEach(vertices))

                    {

                        using (Variable.If(affected[perturbations, vertices]))

                        {

                            perturbation[perturbations, vertices] =

                                Variable.GaussianFromMeanAndVariance(parameters.PerturbationMean, parameters.PerturbationVariance)

                                .Named("perturbationGaussian");

                        }

                        using (Variable.IfNot(affected[perturbations, vertices]))

                        {

                            perturbation[perturbations, vertices] =

                                Variable.GaussianFromMeanAndVariance(1.0, 0.0)

                                .Named("perturbationConstant");

                        }

                    }

                }

     

                using (Variable.ForEach(observations))

                {

                    using (Variable.Case(perturbationsApplied[observations], 0))

                    {

                        using (Variable.ForEach(vertices))

                        {

                            combinedPerturbation[observations, vertices] = Variable.Constant(1.0);

                        }

                    }

                    using (Variable.Case(perturbationsApplied[observations], 1))

                    {

                        var zero = Variable.Constant(0).Named("zero");

                        using (Variable.ForEach(vertices))

                        {

                            combinedPerturbation[observations, vertices] =

                                perturbation[perturbed[observations][zero], vertices] *

                                perturbationLevel[observations][zero];

                        }

                    }

                }

     

    The exception is:

     

    MicrosoftResearch.Transforms.TransformFailedException was unhandled

      Message=SchedulingTransform failed with 1 error(s) and 0 warning(s):

    Error in the application.

      Internal: Update() schedule has a constant statement: for(int observations = 0; observations<observationCount; observations++)

    {

                vdouble113_uses_B[observations][0] = GaussianProductVmpOp.AAverageLogarithm(rnaLevel1_observations_cond_model_1_B[observations], combinedPerturbation[observations, vint25]);

    }

     in

    for(int observations = 0; observations<observationCount; observations++)

    {

                vdouble113_uses_B[observations][0] = GaussianProductVmpOp.AAverageLogarithm(rnaLevel1_observations_cond_model_1_B[observations], combinedPerturbation[observations, vint25]);

    }

     

     

      Source=Infer.Compiler

      StackTrace:

           at MicrosoftResearch.Transforms.TransformResults.ThrowIfErrors(String msg, Boolean treatWarningsAsErrors) in C:\infernetBuilds\12-11-2009_17-18\Compiler\TransformFramework\TransformResults.cs:line 80

           at MicrosoftResearch.Transforms.TransformResults.ThrowIfErrors(String msg) in C:\infernetBuilds\12-11-2009_17-18\Compiler\TransformFramework\TransformResults.cs:line 70

           at MicrosoftResearch.Transforms.TransformerChain.TransformToDeclaration(ITypeDeclaration itd, AttributeRegistry`2 inputAttributes) in C:\infernetBuilds\12-11-2009_17-18\Compiler\TransformFramework\TransformerChain.cs:line 80

           at MicrosoftResearch.Infer.ModelCompiler.CompileWithoutParams(ITypeDeclaration itd, MethodBase method, AttributeRegistry`2 inputAttributes) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\ModelCompiler.cs:line 252

           at MicrosoftResearch.Infer.Models.ModelBuilder.Compile(InferenceEngine engine, Boolean checkParamsAreSet) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\Models\ModelBuilder.cs:line 186

           at MicrosoftResearch.Infer.InferenceEngine.GetCompiledInferenceAlgorithm(IEnumerable`1 vars, Boolean checkParamsAreSet, Boolean inferOnlySpecifiedVars) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\InferenceEngine.cs:line 402

           at MicrosoftResearch.Infer.InferenceEngine.InferAll(Boolean inferOnlySpecifiedVars, IEnumerable`1 vars) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\InferenceEngine.cs:line 346

           at MicrosoftResearch.Infer.InferenceEngine.Infer(IVariable var) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\InferenceEngine.cs:line 131

           at MicrosoftResearch.Infer.InferenceEngine.Infer[TReturn](IVariable var) in C:\infernetBuilds\12-11-2009_17-18\Compiler\Infer\InferenceEngine.cs:line 194

           at Stitch.Model.Infer(Observation[] observations, Double edgeInfluenceMean) in C:\Users\ravip\Documents\Extreme\Dream\Stitch\Stitch\Model.cs:line 575

           at Test.Program.Main(String[] args) in C:\Users\ravip\Documents\Extreme\Dream\Stitch\Test\Program.cs:line 106

           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)

           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)

           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

           at System.Threading.ThreadHelper.ThreadStart()

      InnerException:  

     

    Ravi

    Friday, June 3, 2011 5:59 PM