> ## Documentation Index
> Fetch the complete documentation index at: https://proto.evodesign.org/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Architecture Overview

> How Proto turns biological requirements into optimized sequences

Proto translates a set of biological requirements into optimized sequences. The requirements are declared as constraints, and the framework searches sequence space for sequences that satisfy them.

Without a framework, sequence design is a manual loop: a sequence is designed by hand, prediction tools are run one at a time, the results are evaluated, and the sequence is revised over many iterations. Proto automates this loop. Requirements are expressed once as constraints, an optimizer searches sequence space, and the output is a set of sequences ranked by score.

***

## The Pipeline

Every design follows the same five-stage pipeline:

<div className="block dark:hidden">
  <svg viewBox="0 0 900 250" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Proto five-stage design pipeline" style={{width:"100%",height:"auto",display:"block"}}><defs><pattern id="gridpiL" width="22" height="22" patternUnits="userSpaceOnUse"><circle cx="2" cy="2" r="1.2" fill="#344649" fillOpacity="0.10" /></pattern><marker id="arrpiL" viewBox="0 0 10 10" refX="8.5" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10 L3,5 z" fill="#768b8e" /></marker></defs><rect x="12" y="12" width="876" height="226" rx="16" fill="#f9fcfc" stroke="#dee9e8" strokeWidth="1.2" /><rect x="12" y="12" width="876" height="226" rx="16" fill="url(#gridpiL)" /><path d="M168,138 L208,138" fill="none" stroke="#9eb4b2" strokeWidth="1.6" markerEnd="url(#arrpiL)" /><path d="M338,138 L378,138" fill="none" stroke="#9eb4b2" strokeWidth="1.6" markerEnd="url(#arrpiL)" /><path d="M508,138 L548,138" fill="none" stroke="#9eb4b2" strokeWidth="1.6" markerEnd="url(#arrpiL)" /><path d="M678,138 L718,138" fill="none" stroke="#9eb4b2" strokeWidth="1.6" markerEnd="url(#arrpiL)" /><path d="M614,96 C 614,50 274,50 274,96" fill="none" stroke="#9eb4b2" strokeWidth="1.6" markerEnd="url(#arrpiL)" /><rect x="40" y="96" width="128" height="84" rx="10" fill="#eef2f4" stroke="#dbe3e6" strokeWidth="1.2" /><rect x="90" y="108" width="28" height="3.5" rx="2" fill="#768b8e" /><text x="104" y="128" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#344649" textAnchor="middle">Define</text><text x="104" y="146" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#768b8e" textAnchor="middle">Segments &</text><text x="104" y="161" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#768b8e" textAnchor="middle">Constructs</text><rect x="210" y="96" width="128" height="84" rx="10" fill="#046e7a" /><rect x="260" y="108" width="28" height="3.5" rx="2" fill="#046e7a" /><text x="274" y="128" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#ffffff" textAnchor="middle">Generate</text><text x="274" y="146" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#bfe2e7" textAnchor="middle">Propose</text><text x="274" y="161" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#bfe2e7" textAnchor="middle">candidates</text><rect x="380" y="96" width="128" height="84" rx="10" fill="#eef2f4" stroke="#dbe3e6" strokeWidth="1.2" /><rect x="430" y="108" width="28" height="3.5" rx="2" fill="#768b8e" /><text x="444" y="128" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#344649" textAnchor="middle">Evaluate</text><text x="444" y="146" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#768b8e" textAnchor="middle">Score with</text><text x="444" y="161" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#768b8e" textAnchor="middle">constraints</text><rect x="550" y="96" width="128" height="84" rx="10" fill="#eef2f4" stroke="#dbe3e6" strokeWidth="1.2" /><rect x="600" y="108" width="28" height="3.5" rx="2" fill="#768b8e" /><text x="614" y="128" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#344649" textAnchor="middle">Select</text><text x="614" y="146" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#768b8e" textAnchor="middle">Keep the</text><text x="614" y="161" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#768b8e" textAnchor="middle">best</text><rect x="720" y="96" width="128" height="84" rx="10" fill="#2f8f6b" /><rect x="770" y="108" width="28" height="3.5" rx="2" fill="#2f8f6b" /><text x="784" y="128" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#ffffff" textAnchor="middle">Results</text><text x="784" y="146" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#d4ebe0" textAnchor="middle">Optimized</text><text x="784" y="161" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#d4ebe0" textAnchor="middle">sequences</text><g fill="#ffffff" stroke="#9eb4b2" strokeWidth="1.4"><circle cx="168" cy="138" r="3.2" /><circle cx="210" cy="138" r="3.2" /><circle cx="338" cy="138" r="3.2" /><circle cx="380" cy="138" r="3.2" /><circle cx="508" cy="138" r="3.2" /><circle cx="550" cy="138" r="3.2" /><circle cx="678" cy="138" r="3.2" /><circle cx="720" cy="138" r="3.2" /><circle cx="614" cy="96" r="3.2" /><circle cx="274" cy="96" r="3.2" /></g><rect x="413" y="39.25" width="62" height="21.5" rx="6" fill="#f9fcfc" stroke="#e2e9ea" strokeWidth="1" /><text x="444" y="54" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#506467" textAnchor="middle">iterate</text></svg>
</div>

<div className="hidden dark:block">
  <svg viewBox="0 0 900 250" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Proto five-stage design pipeline" style={{width:"100%",height:"auto",display:"block"}}><defs><pattern id="gridpiD" width="22" height="22" patternUnits="userSpaceOnUse"><circle cx="2" cy="2" r="1.2" fill="#9eb4b2" fillOpacity="0.10" /></pattern><marker id="arrpiD" viewBox="0 0 10 10" refX="8.5" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10 L3,5 z" fill="#7e9498" /></marker></defs><rect x="12" y="12" width="876" height="226" rx="16" fill="#0e1718" stroke="#2b3c3e" strokeWidth="1.2" /><rect x="12" y="12" width="876" height="226" rx="16" fill="url(#gridpiD)" /><path d="M168,138 L208,138" fill="none" stroke="#566b6e" strokeWidth="1.6" markerEnd="url(#arrpiD)" /><path d="M338,138 L378,138" fill="none" stroke="#566b6e" strokeWidth="1.6" markerEnd="url(#arrpiD)" /><path d="M508,138 L548,138" fill="none" stroke="#566b6e" strokeWidth="1.6" markerEnd="url(#arrpiD)" /><path d="M678,138 L718,138" fill="none" stroke="#566b6e" strokeWidth="1.6" markerEnd="url(#arrpiD)" /><path d="M614,96 C 614,50 274,50 274,96" fill="none" stroke="#566b6e" strokeWidth="1.6" markerEnd="url(#arrpiD)" /><rect x="40" y="96" width="128" height="84" rx="10" fill="#1b2829" stroke="#33474a" strokeWidth="1.2" /><rect x="90" y="108" width="28" height="3.5" rx="2" fill="#7e9498" /><text x="104" y="128" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#d6e1df" textAnchor="middle">Define</text><text x="104" y="146" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#9eb4b2" textAnchor="middle">Segments &</text><text x="104" y="161" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#9eb4b2" textAnchor="middle">Constructs</text><rect x="210" y="96" width="128" height="84" rx="10" fill="#0a7e8c" /><rect x="260" y="108" width="28" height="3.5" rx="2" fill="#0a7e8c" /><text x="274" y="128" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#ffffff" textAnchor="middle">Generate</text><text x="274" y="146" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#c0e6ea" textAnchor="middle">Propose</text><text x="274" y="161" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#c0e6ea" textAnchor="middle">candidates</text><rect x="380" y="96" width="128" height="84" rx="10" fill="#1b2829" stroke="#33474a" strokeWidth="1.2" /><rect x="430" y="108" width="28" height="3.5" rx="2" fill="#7e9498" /><text x="444" y="128" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#d6e1df" textAnchor="middle">Evaluate</text><text x="444" y="146" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#9eb4b2" textAnchor="middle">Score with</text><text x="444" y="161" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#9eb4b2" textAnchor="middle">constraints</text><rect x="550" y="96" width="128" height="84" rx="10" fill="#1b2829" stroke="#33474a" strokeWidth="1.2" /><rect x="600" y="108" width="28" height="3.5" rx="2" fill="#7e9498" /><text x="614" y="128" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#d6e1df" textAnchor="middle">Select</text><text x="614" y="146" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#9eb4b2" textAnchor="middle">Keep the</text><text x="614" y="161" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#9eb4b2" textAnchor="middle">best</text><rect x="720" y="96" width="128" height="84" rx="10" fill="#2f8f6b" /><rect x="770" y="108" width="28" height="3.5" rx="2" fill="#37a07c" /><text x="784" y="128" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#ffffff" textAnchor="middle">Results</text><text x="784" y="146" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#cfeadd" textAnchor="middle">Optimized</text><text x="784" y="161" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#cfeadd" textAnchor="middle">sequences</text><g fill="#13201f" stroke="#566b6e" strokeWidth="1.4"><circle cx="168" cy="138" r="3.2" /><circle cx="210" cy="138" r="3.2" /><circle cx="338" cy="138" r="3.2" /><circle cx="380" cy="138" r="3.2" /><circle cx="508" cy="138" r="3.2" /><circle cx="550" cy="138" r="3.2" /><circle cx="678" cy="138" r="3.2" /><circle cx="720" cy="138" r="3.2" /><circle cx="614" cy="96" r="3.2" /><circle cx="274" cy="96" r="3.2" /></g><rect x="413" y="39.25" width="62" height="21.5" rx="6" fill="#13201f" stroke="#33474a" strokeWidth="1" /><text x="444" y="54" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#9eb4b2" textAnchor="middle">iterate</text></svg>
</div>

***

## Core Components

<CardGroup cols={3}>
  <Card title="Sequence" icon="dna" href="/docs/language/concepts/sequences">
    The fundamental data unit: a biological string (DNA, RNA, protein, or ligand) with type validation and rich metadata.
  </Card>

  <Card title="Segment" icon="rectangle-horizontal" href="/docs/language/concepts/segments">
    A region to design. Maintains dual pools of proposal and result sequences during optimization.
  </Card>

  <Card title="Construct" icon="layers" href="/docs/language/concepts/constructs">
    An ordered collection of Segments representing a complete biological design, like a gene expression cassette.
  </Card>

  <Card title="Generator" icon="cpu" href="/docs/language/concepts/generators">
    Proposes new sequences through mutation, autoregressive generation, inverse folding, or gradient-based design.
  </Card>

  <Card title="Constraint" icon="square-function" href="/docs/language/concepts/constraints">
    Scores how well sequences meet requirements. Returns 0.0 (perfect) to 1.0 (worst violation).
  </Card>

  <Card title="Optimizer" icon="chart-line" href="/docs/language/concepts/optimizers">
    Orchestrates the generate-evaluate-select loop using search strategies such as MCMC or beam search.
  </Card>
</CardGroup>

<Tip>
  A **Program** chains multiple Optimizers together for multi-stage pipelines (e.g., coarse exploration followed by fine-tuning). See [Programs](/docs/language/concepts/programs).
</Tip>

***

## Data Flow

<Steps>
  <Step title="Define the design space">
    **Segments** specify the regions to be designed, for example a 100 bp promoter, a 300-residue enzyme, or an existing sequence to optimize. They are combined into a **Construct** representing the full biological unit.

    ```python python icon="python" theme={null}
    promoter = Segment(length=100, sequence_type="dna", label="promoter")
    cds = Segment(length=900, sequence_type="dna", label="cds")
    construct = Construct([promoter, cds])
    ```
  </Step>

  <Step title="Assign generators to segments">
    Each **Generator** is assigned to a Segment and proposes candidate sequences. Different generators use different strategies: random mutation, model-guided generation, or inverse folding.

    ```python python icon="python" theme={null}
    generator = RandomNucleotideGenerator(RandomNucleotideGeneratorConfig())
    generator.assign(promoter)
    ```
  </Step>

  <Step title="Define constraints with scoring functions">
    **Constraints** evaluate sequences and return a score from 0.0 (perfect) to 1.0 (worst). They can operate on individual segments or across multiple segments.

    ```python python icon="python" theme={null}
    gc_constraint = Constraint(
        inputs=[promoter],
        function=gc_content_constraint,
        function_config={"min_gc": 45, "max_gc": 55}
    )
    ```
  </Step>

  <Step title="Configure and run the optimizer">
    The **Optimizer** drives the search loop: generate proposals, score them with constraints, select the best. It repeats until a stopping criterion is reached.

    ```python python icon="python" theme={null}
    optimizer = MCMCOptimizer(
        constructs=[construct],
        generators=[generator],
        constraints=[gc_constraint],
        config=MCMCOptimizerConfig(num_steps=1000)
    )
    ```
  </Step>

  <Step title="Retrieve optimized sequences">
    After optimization, the best sequences live in each Segment's `result_sequences` pool. The Construct's `joined_sequences` gives the full concatenated results.

    ```python python icon="python" theme={null}
    program = Program(optimizers=[optimizer], num_results=1)
    program.run()

    for seq in construct.joined_sequences:
        print(seq.sequence)
        print(seq.metadata["segments"])  # Per-segment constraint scores
    ```
  </Step>
</Steps>

***

## The Dual Pool Architecture

A key design decision in Proto is that each Segment maintains **two separate sequence pools**. This separation lets optimizers explore freely without losing the best solutions found so far.

<div className="block dark:hidden">
  <svg viewBox="0 0 800 480" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Dual-pool optimization loop inside a Segment" style={{width:"100%",height:"auto",display:"block"}}><defs><pattern id="griddpL" width="22" height="22" patternUnits="userSpaceOnUse"><circle cx="2" cy="2" r="1.2" fill="#344649" fillOpacity="0.10" /></pattern><marker id="arrdpL" viewBox="0 0 10 10" refX="8.5" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10 L3,5 z" fill="#768b8e" /></marker></defs><rect x="12" y="12" width="776" height="456" rx="16" fill="#f9fcfc" stroke="#dee9e8" strokeWidth="1.2" /><rect x="12" y="12" width="776" height="456" rx="16" fill="url(#griddpL)" /><rect x="268" y="92" width="280" height="320" rx="14" fill="#eef5f4" stroke="#ced9d7" strokeWidth="1.3" fillOpacity="0.55" strokeDasharray="5 4" /><text x="286" y="113" fontFamily="'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="10.5" fontWeight="500" fill="#768b8e" textAnchor="start" letterSpacing="1.6">SEGMENT</text><path d="M200,174 L292,174" fill="none" stroke="#9eb4b2" strokeWidth="1.6" markerEnd="url(#arrdpL)" /><path d="M524,160 C 558,160 578,167 604,168" fill="none" stroke="#9eb4b2" strokeWidth="1.6" markerEnd="url(#arrdpL)" /><path d="M682,206 L682,298" fill="none" stroke="#9eb4b2" strokeWidth="1.6" markerEnd="url(#arrdpL)" /><path d="M604,331 C 574,332 550,332 524,332" fill="none" stroke="#9eb4b2" strokeWidth="1.6" markerEnd="url(#arrdpL)" /><path d="M360,286 L360,220" fill="none" stroke="#9eb4b2" strokeWidth="1.6" markerEnd="url(#arrdpL)" /><rect x="44" y="141" width="156" height="66" rx="10" fill="#eef2f4" stroke="#dbe3e6" strokeWidth="1.2" /><rect x="54" y="153" width="4" height="42" rx="2" fill="#768b8e" /><text x="66" y="167" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14.5" fontWeight="600" fill="#344649" textAnchor="start">Generator</text><text x="66" y="185" fontFamily="'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="10.5" fontWeight="400" fill="#768b8e" textAnchor="start">samples</text><rect x="604" y="140" width="156" height="66" rx="10" fill="#eef2f4" stroke="#dbe3e6" strokeWidth="1.2" /><rect x="614" y="152" width="4" height="42" rx="2" fill="#768b8e" /><text x="626" y="166" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14.5" fontWeight="600" fill="#344649" textAnchor="start">Constraints</text><text x="626" y="184" fontFamily="'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="10.5" fontWeight="400" fill="#768b8e" textAnchor="start">evaluates</text><rect x="604" y="298" width="156" height="66" rx="10" fill="#046e7a" /><rect x="614" y="310" width="4" height="42" rx="2" fill="#bfe2e7" /><text x="626" y="324" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14.5" fontWeight="600" fill="#ffffff" textAnchor="start">Optimizer</text><text x="626" y="342" fontFamily="'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="10.5" fontWeight="400" fill="#bfe2e7" textAnchor="start">selects</text><rect x="292" y="128" width="232" height="92" rx="10" fill="#f4f9f9" stroke="#dbe6e4" strokeWidth="1.2" /><rect x="302" y="140" width="4" height="68" rx="2" fill="#046e7a" /><text x="314" y="166" fontFamily="'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="14" fontWeight="600" fill="#1d2c2f" textAnchor="start">proposal\_sequences</text><text x="314" y="185" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="12" fontWeight="400" fill="#768b8e" textAnchor="start">Working space for proposals</text><rect x="292" y="286" width="232" height="92" rx="10" fill="#f4f9f9" stroke="#dbe6e4" strokeWidth="1.2" /><rect x="302" y="298" width="4" height="68" rx="2" fill="#2f8f6b" /><text x="314" y="324" fontFamily="'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="14" fontWeight="600" fill="#1d2c2f" textAnchor="start">result\_sequences</text><text x="314" y="343" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="12" fontWeight="400" fill="#768b8e" textAnchor="start">Best sequences found</text><g fill="#ffffff" stroke="#9eb4b2" strokeWidth="1.4"><circle cx="200" cy="174" r="3.2" /><circle cx="292" cy="174" r="3.2" /><circle cx="524" cy="160" r="3.2" /><circle cx="360" cy="220" r="3.2" /><circle cx="524" cy="332" r="3.2" /><circle cx="360" cy="286" r="3.2" /><circle cx="604" cy="168" r="3.2" /><circle cx="682" cy="206" r="3.2" /><circle cx="682" cy="298" r="3.2" /><circle cx="604" cy="331" r="3.2" /></g><rect x="204" y="163" width="84" height="22" rx="6" fill="#f9fcfc" stroke="#e2e9ea" strokeWidth="1" /><text x="246" y="178" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#506467" textAnchor="middle">proposes into</text><rect x="529" y="139.25" width="74" height="21.5" rx="6" fill="#f9fcfc" stroke="#e2e9ea" strokeWidth="1" /><text x="566" y="154" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#506467" textAnchor="middle">scored by</text><rect x="688" y="241.25" width="74" height="21.5" rx="6" fill="#f9fcfc" stroke="#e2e9ea" strokeWidth="1" /><text x="725" y="256" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#506467" textAnchor="middle">ranked by</text><rect x="531" y="313.5" width="68" height="35" rx="6" fill="#f9fcfc" stroke="#e2e9ea" strokeWidth="1" /><text x="565" y="328.25" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#506467" textAnchor="middle">promotes</text><text x="565" y="341.75" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#506467" textAnchor="middle">best to</text><rect x="320" y="235.5" width="80" height="35" rx="6" fill="#f9fcfc" stroke="#e2e9ea" strokeWidth="1" /><text x="360" y="250.25" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#506467" textAnchor="middle">seeds</text><text x="360" y="263.75" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#506467" textAnchor="middle">next round</text></svg>
</div>

<div className="hidden dark:block">
  <svg viewBox="0 0 800 480" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Dual-pool optimization loop inside a Segment" style={{width:"100%",height:"auto",display:"block"}}><defs><pattern id="griddpD" width="22" height="22" patternUnits="userSpaceOnUse"><circle cx="2" cy="2" r="1.2" fill="#9eb4b2" fillOpacity="0.10" /></pattern><marker id="arrdpD" viewBox="0 0 10 10" refX="8.5" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10 L3,5 z" fill="#7e9498" /></marker></defs><rect x="12" y="12" width="776" height="456" rx="16" fill="#0e1718" stroke="#2b3c3e" strokeWidth="1.2" /><rect x="12" y="12" width="776" height="456" rx="16" fill="url(#griddpD)" /><rect x="268" y="92" width="280" height="320" rx="14" fill="#15211f" stroke="#33474a" strokeWidth="1.3" fillOpacity="0.5" strokeDasharray="5 4" /><text x="286" y="113" fontFamily="'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="10.5" fontWeight="500" fill="#7e9498" textAnchor="start" letterSpacing="1.6">SEGMENT</text><path d="M200,174 L292,174" fill="none" stroke="#566b6e" strokeWidth="1.6" markerEnd="url(#arrdpD)" /><path d="M524,160 C 558,160 578,167 604,168" fill="none" stroke="#566b6e" strokeWidth="1.6" markerEnd="url(#arrdpD)" /><path d="M682,206 L682,298" fill="none" stroke="#566b6e" strokeWidth="1.6" markerEnd="url(#arrdpD)" /><path d="M604,331 C 574,332 550,332 524,332" fill="none" stroke="#566b6e" strokeWidth="1.6" markerEnd="url(#arrdpD)" /><path d="M360,286 L360,220" fill="none" stroke="#566b6e" strokeWidth="1.6" markerEnd="url(#arrdpD)" /><rect x="44" y="141" width="156" height="66" rx="10" fill="#1b2829" stroke="#33474a" strokeWidth="1.2" /><rect x="54" y="153" width="4" height="42" rx="2" fill="#7e9498" /><text x="66" y="167" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14.5" fontWeight="600" fill="#d6e1df" textAnchor="start">Generator</text><text x="66" y="185" fontFamily="'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="10.5" fontWeight="400" fill="#8aa0a2" textAnchor="start">samples</text><rect x="604" y="140" width="156" height="66" rx="10" fill="#1b2829" stroke="#33474a" strokeWidth="1.2" /><rect x="614" y="152" width="4" height="42" rx="2" fill="#7e9498" /><text x="626" y="166" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14.5" fontWeight="600" fill="#d6e1df" textAnchor="start">Constraints</text><text x="626" y="184" fontFamily="'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="10.5" fontWeight="400" fill="#8aa0a2" textAnchor="start">evaluates</text><rect x="604" y="298" width="156" height="66" rx="10" fill="#0a7e8c" /><rect x="614" y="310" width="4" height="42" rx="2" fill="#c0e6ea" /><text x="626" y="324" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14.5" fontWeight="600" fill="#ffffff" textAnchor="start">Optimizer</text><text x="626" y="342" fontFamily="'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="10.5" fontWeight="400" fill="#c0e6ea" textAnchor="start">selects</text><rect x="292" y="128" width="232" height="92" rx="10" fill="#1a2a2b" stroke="#33474a" strokeWidth="1.2" /><rect x="302" y="140" width="4" height="68" rx="2" fill="#0a7e8c" /><text x="314" y="166" fontFamily="'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="14" fontWeight="600" fill="#eef5f4" textAnchor="start">proposal\_sequences</text><text x="314" y="185" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="12" fontWeight="400" fill="#9eb4b2" textAnchor="start">Working space for proposals</text><rect x="292" y="286" width="232" height="92" rx="10" fill="#1a2a2b" stroke="#33474a" strokeWidth="1.2" /><rect x="302" y="298" width="4" height="68" rx="2" fill="#37a07c" /><text x="314" y="324" fontFamily="'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="14" fontWeight="600" fill="#eef5f4" textAnchor="start">result\_sequences</text><text x="314" y="343" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="12" fontWeight="400" fill="#9eb4b2" textAnchor="start">Best sequences found</text><g fill="#13201f" stroke="#566b6e" strokeWidth="1.4"><circle cx="200" cy="174" r="3.2" /><circle cx="292" cy="174" r="3.2" /><circle cx="524" cy="160" r="3.2" /><circle cx="360" cy="220" r="3.2" /><circle cx="524" cy="332" r="3.2" /><circle cx="360" cy="286" r="3.2" /><circle cx="604" cy="168" r="3.2" /><circle cx="682" cy="206" r="3.2" /><circle cx="682" cy="298" r="3.2" /><circle cx="604" cy="331" r="3.2" /></g><rect x="204" y="163" width="84" height="22" rx="6" fill="#13201f" stroke="#33474a" strokeWidth="1" /><text x="246" y="178" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#9eb4b2" textAnchor="middle">proposes into</text><rect x="529" y="139.25" width="74" height="21.5" rx="6" fill="#13201f" stroke="#33474a" strokeWidth="1" /><text x="566" y="154" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#9eb4b2" textAnchor="middle">scored by</text><rect x="688" y="241.25" width="74" height="21.5" rx="6" fill="#13201f" stroke="#33474a" strokeWidth="1" /><text x="725" y="256" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#9eb4b2" textAnchor="middle">ranked by</text><rect x="531" y="313.5" width="68" height="35" rx="6" fill="#13201f" stroke="#33474a" strokeWidth="1" /><text x="565" y="328.25" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#9eb4b2" textAnchor="middle">promotes</text><text x="565" y="341.75" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#9eb4b2" textAnchor="middle">best to</text><rect x="320" y="235.5" width="80" height="35" rx="6" fill="#13201f" stroke="#33474a" strokeWidth="1" /><text x="360" y="250.25" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#9eb4b2" textAnchor="middle">seeds</text><text x="360" y="263.75" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#9eb4b2" textAnchor="middle">next round</text></svg>
</div>

<Columns>
  <Column>
    ### Proposal Pool

    * **Purpose**: Workspace for the optimizer
    * **Populated by**: Generators (mutations, new proposals)
    * **Consumed by**: Constraints (scoring) and Optimizer (selection)
    * **Lifecycle**: Rebuilt every optimization step
  </Column>

  <Column>
    ### Result Pool

    * **Purpose**: Best results found so far
    * **Populated by**: Optimizer (after ranking proposals)
    * **Consumed by**: User (final output), next stage in a Program
    * **Lifecycle**: Persists across optimization steps and stages
  </Column>
</Columns>

***

## Design Patterns

<Tabs>
  <Tab title="Single Constraint">
    The simplest pattern: one segment, one constraint, one optimizer, used for a single design objective.

    **Example**: Design a 100 bp DNA promoter with 50-60% GC content.

    ```python python icon="python" theme={null}
    from proto_language.core import Segment, Construct
    from proto_language import Program, Constraint
    from proto_language.generator import RandomNucleotideGenerator, RandomNucleotideGeneratorConfig
    from proto_language.constraint import gc_content_constraint
    from proto_language.optimizer import MCMCOptimizer, MCMCOptimizerConfig

    segment = Segment(length=100, sequence_type="dna", label="promoter")
    construct = Construct([segment])

    generator = RandomNucleotideGenerator(RandomNucleotideGeneratorConfig())
    generator.assign(segment)

    constraint = Constraint(
        inputs=[segment],
        function=gc_content_constraint,
        function_config={"min_gc": 50, "max_gc": 60}
    )

    optimizer = MCMCOptimizer(
        constructs=[construct],
        generators=[generator],
        constraints=[constraint],
        config=MCMCOptimizerConfig(num_steps=1000)
    )

    program = Program(optimizers=[optimizer], num_results=1)
    program.run()
    ```
  </Tab>

  <Tab title="Multi-Constraint">
    Multiple constraints on the same segment. Scores are combined into a weighted energy value that the optimizer minimizes.

    **Example**: Design a protein with high stability (pLDDT) and minimal low-complexity regions.

    ```python python icon="python" theme={null}
    segment = Segment(length=200, sequence_type="protein", label="enzyme")
    construct = Construct([segment])

    generator = ESM2Generator(ESM2GeneratorConfig())
    generator.assign(segment)

    constraints = [
        Constraint(
            inputs=[segment],
            function=structure_plddt_constraint,
            function_config={"structure_tool": "esmfold"},
            weight=2.0,  # Higher weight = more important
        ),
        Constraint(
            inputs=[segment],
            function=protein_complexity_constraint,
            function_config={"max_low_complexity": 0.3},
            weight=1.0,
        ),
    ]

    optimizer = MCMCOptimizer(
        constructs=[construct],
        generators=[generator],
        constraints=constraints,
        config=MCMCOptimizerConfig(num_steps=500)
    )
    ```
  </Tab>

  <Tab title="Multi-Stage">
    Optimizers are chained for coarse-to-fine search. The first stage explores broadly with cheap constraints; later stages refine with expensive ones. Stages share the same Construct objects, so results flow through.

    **Example**: Broad exploration with sequence-level constraints, then structure-guided refinement.

    ```python python icon="python" theme={null}
    segment = Segment(length=300, sequence_type="protein", label="target")
    construct = Construct([segment])

    # Stage 1: Broad exploration with a fast sequence-quality constraint
    random_generator = RandomProteinGenerator(RandomProteinGeneratorConfig())
    random_generator.assign(segment)
    complexity = Constraint(
        inputs=[segment],
        function=protein_complexity_constraint,
        function_config={"max_low_complexity": 0.3},
    )
    stage1 = RejectionSamplingOptimizer(
        constructs=[construct],
        generators=[random_generator],
        constraints=[complexity],
        config=RejectionSamplingOptimizerConfig(num_samples=5000, num_results=50),
    )

    # Stage 2: Refinement with expensive structure prediction (same construct object)
    esm2_generator = ESM2Generator(ESM2GeneratorConfig())
    esm2_generator.assign(segment)
    plddt = Constraint(
        inputs=[segment],
        function=structure_plddt_constraint,
        function_config={"structure_tool": "esmfold"},
    )
    stage2 = MCMCOptimizer(
        constructs=[construct],
        generators=[esm2_generator],
        constraints=[plddt],
        config=MCMCOptimizerConfig(num_steps=200),
    )

    program = Program(optimizers=[stage1, stage2], num_results=10)
    program.run()  # Stage 1 results feed into Stage 2
    ```

    <Warning>
      Multi-stage pipelines must share the **same Construct objects by identity** (not copies). This is how results flow from one stage to the next.
    </Warning>
  </Tab>

  <Tab title="Multi-Segment">
    Multiple regions are designed together. Constraints can operate on individual segments or across multiple segments for interaction-aware design.

    **Example**: Design a promoter and coding sequence together, with cross-segment constraints.

    ```python python icon="python" theme={null}
    promoter = Segment(length=100, sequence_type="dna", label="promoter")
    cds = Segment(length=900, sequence_type="dna", label="cds")
    construct = Construct([promoter, cds])

    # Separate generators for each region
    gen_promoter = RandomNucleotideGenerator(RandomNucleotideGeneratorConfig())
    gen_promoter.assign(promoter)
    gen_cds = RandomNucleotideGenerator(RandomNucleotideGeneratorConfig())
    gen_cds.assign(cds)

    constraints = [
        # Per-segment constraints
        Constraint(inputs=[promoter], function=gc_content_constraint,
                   function_config={"min_gc": 45, "max_gc": 55}),
        Constraint(inputs=[cds], function=gc_content_constraint,
                   function_config={"min_gc": 40, "max_gc": 60}),
        # Constraints can also span segments, e.g. inputs=[promoter, cds],
        # for interaction-aware design across regions.
    ]

    optimizer = MCMCOptimizer(
        constructs=[construct],
        generators=[gen_promoter, gen_cds],
        constraints=constraints,
        config=MCMCOptimizerConfig(num_steps=1000)
    )
    ```
  </Tab>
</Tabs>

***

## Choosing a Pattern

<div className="block dark:hidden">
  <svg viewBox="0 0 720 470" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Decision tree for choosing a design pattern" style={{width:"100%",height:"auto",display:"block"}}><defs><pattern id="gridtrL" width="22" height="22" patternUnits="userSpaceOnUse"><circle cx="2" cy="2" r="1.2" fill="#344649" fillOpacity="0.10" /></pattern><marker id="arrtrL" viewBox="0 0 10 10" refX="8.5" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10 L3,5 z" fill="#768b8e" /></marker></defs><rect x="12" y="12" width="696" height="446" rx="16" fill="#f9fcfc" stroke="#dee9e8" strokeWidth="1.2" /><rect x="12" y="12" width="696" height="446" rx="16" fill="url(#gridtrL)" /><rect x="56" y="40" width="214" height="72" rx="10" fill="#f4f9f9" stroke="#dbe6e4" strokeWidth="1.2" /><rect x="66" y="52" width="4" height="48" rx="2" fill="#768b8e" /><text x="163" y="74" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#1d2c2f" textAnchor="middle">Number of regions</text><text x="163" y="92" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#768b8e" textAnchor="middle">being designed?</text><rect x="56" y="168" width="214" height="64" rx="10" fill="#f4f9f9" stroke="#dbe6e4" strokeWidth="1.2" /><rect x="66" y="180" width="4" height="40" rx="2" fill="#768b8e" /><text x="163" y="198" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#1d2c2f" textAnchor="middle">How many</text><text x="163" y="216" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#768b8e" textAnchor="middle">objectives?</text><rect x="56" y="288" width="214" height="64" rx="10" fill="#f4f9f9" stroke="#dbe6e4" strokeWidth="1.2" /><rect x="66" y="300" width="4" height="40" rx="2" fill="#768b8e" /><text x="163" y="318" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#1d2c2f" textAnchor="middle">Coarse-to-fine</text><text x="163" y="336" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#768b8e" textAnchor="middle">search needed?</text><rect x="376" y="40" width="300" height="72" rx="10" fill="#eef2f4" stroke="#dbe3e6" strokeWidth="1.2" /><rect x="386" y="52" width="4" height="48" rx="2" fill="#768b8e" /><text x="526" y="74" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#344649" textAnchor="middle">Multi-Segment</text><text x="526" y="92" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#768b8e" textAnchor="middle">Cross-segment constraints if regions interact</text><rect x="376" y="160" width="300" height="64" rx="10" fill="#046e7a" /><rect x="386" y="172" width="4" height="40" rx="2" fill="#bfe2e7" /><text x="526" y="190" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#ffffff" textAnchor="middle">Single Constraint</text><text x="526" y="208" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#bfe2e7" textAnchor="middle">Simplest pattern</text><rect x="376" y="280" width="300" height="64" rx="10" fill="#eef2f4" stroke="#dbe3e6" strokeWidth="1.2" /><rect x="386" y="292" width="4" height="40" rx="2" fill="#768b8e" /><text x="526" y="310" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#344649" textAnchor="middle">Multi-Constraint</text><text x="526" y="328" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#768b8e" textAnchor="middle">Weights balance competing objectives</text><rect x="376" y="380" width="300" height="64" rx="10" fill="#eef2f4" stroke="#dbe3e6" strokeWidth="1.2" /><rect x="386" y="392" width="4" height="40" rx="2" fill="#768b8e" /><text x="526" y="410" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#344649" textAnchor="middle">Multi-Stage</text><text x="526" y="428" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#768b8e" textAnchor="middle">Cheap constraints first, expensive later</text><path d="M270,76 L376,76" fill="none" stroke="#9eb4b2" strokeWidth="1.6" markerEnd="url(#arrtrL)" /><path d="M163,112 L163,168" fill="none" stroke="#9eb4b2" strokeWidth="1.6" markerEnd="url(#arrtrL)" /><path d="M270,200 L376,192" fill="none" stroke="#9eb4b2" strokeWidth="1.6" markerEnd="url(#arrtrL)" /><path d="M163,232 L163,288" fill="none" stroke="#9eb4b2" strokeWidth="1.6" markerEnd="url(#arrtrL)" /><path d="M270,320 L376,312" fill="none" stroke="#9eb4b2" strokeWidth="1.6" markerEnd="url(#arrtrL)" /><path d="M163,352 L163,412 L376,412" fill="none" stroke="#9eb4b2" strokeWidth="1.6" markerEnd="url(#arrtrL)" /><g fill="#ffffff" stroke="#9eb4b2" strokeWidth="1.4"><circle cx="270" cy="76" r="3.2" /><circle cx="376" cy="76" r="3.2" /><circle cx="163" cy="112" r="3.2" /><circle cx="163" cy="168" r="3.2" /><circle cx="270" cy="200" r="3.2" /><circle cx="376" cy="192" r="3.2" /><circle cx="163" cy="232" r="3.2" /><circle cx="163" cy="288" r="3.2" /><circle cx="270" cy="320" r="3.2" /><circle cx="376" cy="312" r="3.2" /><circle cx="163" cy="412" r="3.2" /><circle cx="376" cy="412" r="3.2" /></g><rect x="289" y="65.25" width="68" height="21.5" rx="6" fill="#f9fcfc" stroke="#e2e9ea" strokeWidth="1" /><text x="323" y="80" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#506467" textAnchor="middle">Multiple</text><rect x="144" y="129.25" width="38" height="21.5" rx="6" fill="#f9fcfc" stroke="#e2e9ea" strokeWidth="1" /><text x="163" y="144" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#506467" textAnchor="middle">One</text><rect x="304" y="185.25" width="38" height="21.5" rx="6" fill="#f9fcfc" stroke="#e2e9ea" strokeWidth="1" /><text x="323" y="200" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#506467" textAnchor="middle">One</text><rect x="129" y="249.25" width="68" height="21.5" rx="6" fill="#f9fcfc" stroke="#e2e9ea" strokeWidth="1" /><text x="163" y="264" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#506467" textAnchor="middle">Multiple</text><rect x="307" y="305.25" width="32" height="21.5" rx="6" fill="#f9fcfc" stroke="#e2e9ea" strokeWidth="1" /><text x="323" y="320" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#506467" textAnchor="middle">No</text><rect x="181" y="401.25" width="38" height="21.5" rx="6" fill="#f9fcfc" stroke="#e2e9ea" strokeWidth="1" /><text x="200" y="416" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#506467" textAnchor="middle">Yes</text></svg>
</div>

<div className="hidden dark:block">
  <svg viewBox="0 0 720 470" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Decision tree for choosing a design pattern" style={{width:"100%",height:"auto",display:"block"}}><defs><pattern id="gridtrD" width="22" height="22" patternUnits="userSpaceOnUse"><circle cx="2" cy="2" r="1.2" fill="#9eb4b2" fillOpacity="0.10" /></pattern><marker id="arrtrD" viewBox="0 0 10 10" refX="8.5" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10 L3,5 z" fill="#7e9498" /></marker></defs><rect x="12" y="12" width="696" height="446" rx="16" fill="#0e1718" stroke="#2b3c3e" strokeWidth="1.2" /><rect x="12" y="12" width="696" height="446" rx="16" fill="url(#gridtrD)" /><rect x="56" y="40" width="214" height="72" rx="10" fill="#1a2a2b" stroke="#33474a" strokeWidth="1.2" /><rect x="66" y="52" width="4" height="48" rx="2" fill="#7e9498" /><text x="163" y="74" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#eef5f4" textAnchor="middle">Number of regions</text><text x="163" y="92" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#9eb4b2" textAnchor="middle">being designed?</text><rect x="56" y="168" width="214" height="64" rx="10" fill="#1a2a2b" stroke="#33474a" strokeWidth="1.2" /><rect x="66" y="180" width="4" height="40" rx="2" fill="#7e9498" /><text x="163" y="198" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#eef5f4" textAnchor="middle">How many</text><text x="163" y="216" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#9eb4b2" textAnchor="middle">objectives?</text><rect x="56" y="288" width="214" height="64" rx="10" fill="#1a2a2b" stroke="#33474a" strokeWidth="1.2" /><rect x="66" y="300" width="4" height="40" rx="2" fill="#7e9498" /><text x="163" y="318" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#eef5f4" textAnchor="middle">Coarse-to-fine</text><text x="163" y="336" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#9eb4b2" textAnchor="middle">search needed?</text><rect x="376" y="40" width="300" height="72" rx="10" fill="#1b2829" stroke="#33474a" strokeWidth="1.2" /><rect x="386" y="52" width="4" height="48" rx="2" fill="#7e9498" /><text x="526" y="74" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#d6e1df" textAnchor="middle">Multi-Segment</text><text x="526" y="92" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#9eb4b2" textAnchor="middle">Cross-segment constraints if regions interact</text><rect x="376" y="160" width="300" height="64" rx="10" fill="#0a7e8c" /><rect x="386" y="172" width="4" height="40" rx="2" fill="#c0e6ea" /><text x="526" y="190" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#ffffff" textAnchor="middle">Single Constraint</text><text x="526" y="208" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#c0e6ea" textAnchor="middle">Simplest pattern</text><rect x="376" y="280" width="300" height="64" rx="10" fill="#1b2829" stroke="#33474a" strokeWidth="1.2" /><rect x="386" y="292" width="4" height="40" rx="2" fill="#7e9498" /><text x="526" y="310" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#d6e1df" textAnchor="middle">Multi-Constraint</text><text x="526" y="328" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#9eb4b2" textAnchor="middle">Weights balance competing objectives</text><rect x="376" y="380" width="300" height="64" rx="10" fill="#1b2829" stroke="#33474a" strokeWidth="1.2" /><rect x="386" y="392" width="4" height="40" rx="2" fill="#7e9498" /><text x="526" y="410" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="14" fontWeight="600" fill="#d6e1df" textAnchor="middle">Multi-Stage</text><text x="526" y="428" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11.5" fontWeight="400" fill="#9eb4b2" textAnchor="middle">Cheap constraints first, expensive later</text><path d="M270,76 L376,76" fill="none" stroke="#566b6e" strokeWidth="1.6" markerEnd="url(#arrtrD)" /><path d="M163,112 L163,168" fill="none" stroke="#566b6e" strokeWidth="1.6" markerEnd="url(#arrtrD)" /><path d="M270,200 L376,192" fill="none" stroke="#566b6e" strokeWidth="1.6" markerEnd="url(#arrtrD)" /><path d="M163,232 L163,288" fill="none" stroke="#566b6e" strokeWidth="1.6" markerEnd="url(#arrtrD)" /><path d="M270,320 L376,312" fill="none" stroke="#566b6e" strokeWidth="1.6" markerEnd="url(#arrtrD)" /><path d="M163,352 L163,412 L376,412" fill="none" stroke="#566b6e" strokeWidth="1.6" markerEnd="url(#arrtrD)" /><g fill="#13201f" stroke="#566b6e" strokeWidth="1.4"><circle cx="270" cy="76" r="3.2" /><circle cx="376" cy="76" r="3.2" /><circle cx="163" cy="112" r="3.2" /><circle cx="163" cy="168" r="3.2" /><circle cx="270" cy="200" r="3.2" /><circle cx="376" cy="192" r="3.2" /><circle cx="163" cy="232" r="3.2" /><circle cx="163" cy="288" r="3.2" /><circle cx="270" cy="320" r="3.2" /><circle cx="376" cy="312" r="3.2" /><circle cx="163" cy="412" r="3.2" /><circle cx="376" cy="412" r="3.2" /></g><rect x="289" y="65.25" width="68" height="21.5" rx="6" fill="#13201f" stroke="#33474a" strokeWidth="1" /><text x="323" y="80" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#9eb4b2" textAnchor="middle">Multiple</text><rect x="144" y="129.25" width="38" height="21.5" rx="6" fill="#13201f" stroke="#33474a" strokeWidth="1" /><text x="163" y="144" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#9eb4b2" textAnchor="middle">One</text><rect x="304" y="185.25" width="38" height="21.5" rx="6" fill="#13201f" stroke="#33474a" strokeWidth="1" /><text x="323" y="200" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#9eb4b2" textAnchor="middle">One</text><rect x="129" y="249.25" width="68" height="21.5" rx="6" fill="#13201f" stroke="#33474a" strokeWidth="1" /><text x="163" y="264" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#9eb4b2" textAnchor="middle">Multiple</text><rect x="307" y="305.25" width="32" height="21.5" rx="6" fill="#13201f" stroke="#33474a" strokeWidth="1" /><text x="323" y="320" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#9eb4b2" textAnchor="middle">No</text><rect x="181" y="401.25" width="38" height="21.5" rx="6" fill="#13201f" stroke="#33474a" strokeWidth="1" /><text x="200" y="416" fontFamily="Geist, ui-sans-serif, system-ui, -apple-system, sans-serif" fontSize="11" fontWeight="400" fill="#9eb4b2" textAnchor="middle">Yes</text></svg>
</div>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Sequences" icon="dna" href="/docs/language/concepts/sequences">
    The fundamental data unit
  </Card>

  <Card title="Segments" icon="rectangle-horizontal" href="/docs/language/concepts/segments">
    Design regions and dual pools
  </Card>

  <Card title="Constraints" icon="square-function" href="/docs/language/concepts/constraints">
    Scoring functions for design objectives
  </Card>

  <Card title="Quickstart" icon="play" href="/docs/language/quickstart">
    A first design, end to end
  </Card>
</CardGroup>
