private Sequence GenerateRawSequence(bool ignoreSegments)
        {
            Sequence sequence = new Sequence();

            double totalTime = 0.0;
            double totalGem = 0.0;
            int columnIdleRegen = 0;
            int columnManaOverflow = -1;
            for (int i = 0; i < SolutionVariable.Count; i++)
            {
                if (SolutionVariable[i].Type == VariableType.IdleRegen)
                {
                    columnIdleRegen = i;
                    break;
                }
            }
            for (int i = 0; i < SolutionVariable.Count; i++)
            {
                if (SolutionVariable[i].Type == VariableType.ManaGem)
                {
                    sequence.ColumnManaGem = i;
                    break;
                }
            }
            for (int i = 0; i < SolutionVariable.Count; i++)
            {
                if (SolutionVariable[i].Type == VariableType.ManaPotion)
                {
                    sequence.ColumnManaPotion = i;
                    break;
                }
            }
            for (int i = 0; i < SolutionVariable.Count; i++)
            {
                if (SolutionVariable[i].Type == VariableType.ManaOverflow)
                {
                    columnManaOverflow = i;
                    break;
                }
            }
            for (int i = 0; i < SolutionVariable.Count; i++)
            {
                if (Solution[i] > 0.01 && SolutionVariable[i].Type != VariableType.ManaOverflow)
                {
                    SequenceItem item = new SequenceItem(i, Solution[i]);
                    if (ignoreSegments) item.Segment = 0;
                    sequence.Add(item);
                    if (!item.IsManaPotionOrGem) totalTime += item.Duration;
                    if (item.VariableType == VariableType.ManaGem) totalGem += Solution[i];
                }
            }
            if (CalculationOptions.TargetDamage == 0.0 && totalTime < CalculationOptions.FightDuration - 0.00001)
            {
                sequence.Add(new SequenceItem(columnIdleRegen, CalculationOptions.FightDuration - totalTime));
            }

            // evaluate sequence

            /*unexplained = sequence.Evaluate(timing, Sequence.EvaluationMode.Unexplained);
            if (unexplained < bestUnexplained)
            {
                bestUnexplained = unexplained;
                bestTiming = timing.ToString();
            }*/

            sequence.GroupMoltenFury();
            SequenceGroup heroismGroup = sequence.GroupHeroism();
            if (CalculationOptions.HeroismControl == 3)
            {
                heroismGroup.MinTime = Math.Min(CalculationOptions.FightDuration - CalculationOptions.MoltenFuryPercentage * CalculationOptions.FightDuration, CalculationOptions.FightDuration - 40.0);
            }            
            sequence.GroupCombustion();
            sequence.GroupArcanePower();
            sequence.GroupVolcanicPotion();
            foreach (EffectCooldown cooldown in ItemBasedEffectCooldowns)
            {
                sequence.GroupSpecialEffect(cooldown);
            }
            List<SequenceGroup> list = sequence.GroupManaGemEffect();
            if (list != null && ManaGemEffect && CalculationOptions.DisplaySegmentCooldowns && columnManaOverflow != -1)
            {
                float manaBurn = 0;
                for (int i = 0; i < SolutionVariable.Count; i++)
                {
                    if (Solution[i] > 0.01 && SolutionVariable[i].Segment == 0 && SolutionVariable[i].Type == VariableType.Spell)
                    {
                        CastingState state = SolutionVariable[i].State;
                        if (state != null && !state.EffectsActive((int)StandardEffect.ManaGemEffect))
                        {
                            float burn = (float)SolutionVariable[i].Cycle.ManaPerSecond;
                            if (burn > manaBurn) manaBurn = burn;
                        }
                    }
                }

                double overflow = Solution[columnManaOverflow];
                double tmin = 0;
                if (manaBurn > 0) tmin = (ManaGemValue * (1 + BaseStats.BonusManaGem) - overflow) / manaBurn;

                foreach (SequenceGroup g in list)
                {
                    if (g.Segment == 0) g.MinTime = tmin;
                }
            }
            sequence.GroupIcyVeins(); // should come after trinkets because of coldsnap
            //sequence.GroupWaterElemental();
            sequence.GroupMirrorImage();
            sequence.GroupBerserking();
            sequence.GroupPowerInfusion();
            sequence.GroupFlameOrb();
            list = sequence.GroupFlameCap();
            // very very special case for now
            if (list != null && list.Count == 2 && CalculationOptions.FightDuration < 400 && totalGem >= 1)
            {
                foreach (SequenceGroup group in list)
                {
                    foreach (CooldownConstraint constraint in group.Constraint)
                    {
                        if (constraint.EffectCooldown.StandardEffect == StandardEffect.FlameCap)
                        {
                            constraint.Cooldown = 300.0;
                        }
                    }
                }
            }
            sequence.GroupEvocation();
            return sequence;
        }