[Canonical page](<https://docs.dhtmlx.com/planning-engine/rust/api/core/evaluate/amount/>)
[Full documentation index](<https://docs.dhtmlx.com/planning-engine/llms.txt>)


# Amount

A number measured on one evaluation stage, paired with its difference from the same number measured on the baseline. [`Project::evaluate`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/project/project.md#evaluate>) returns it inside [`Metrics`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/evaluate/metrics.md>) as `conflicts` and `cycles`, inside [`Overload`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/evaluate/overload.md>) as `total`, and inside [`ResourceOverload`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/evaluate/resource-overload.md>) as `overload`. It isn't built by hand.

## Declaration

```rust
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Amount {
    pub value: f64,
    pub delta: f64,
}
```

With the `serde` feature (`cargo add plen-core --features serde`), `Amount` also implements `Serialize` and `Deserialize`.

## Fields

| Field | Type | Description |
|---|---|---|
| `value` | `f64` | The value measured on this stage. |
| `delta` | `f64` | `value` minus the baseline value. Positive when this stage has more. Always `0` in [`EvaluateResult::baseline`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/evaluate/evaluate-result.md>). |

The unit of both fields depends on the field that holds the `Amount`. See [`Metrics`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/evaluate/metrics.md>) and [`Overload`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/evaluate/overload.md>).

## Example

Score a candidate and print the change in total overload against the baseline.

```rust
use plen_core::{
    AssignmentData, Candidate, DateTime, EvaluateOptions, Project, ProjectData,
    ProjectOptions, ResourceData, SchedulingChanges, SolveOptions, TaskData,
};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let monday = DateTime::from_ymd_hm(2026, 8, 10, 8, 0).ok_or("invalid date")?;

    let task = |id: i32| TaskData {
        start_date: Some(monday),
        duration: Some(2.0),
        ..TaskData::new(id)
    };
    let assign = |task: i32| AssignmentData {
        id: None,
        task: task.into(),
        resource: "dev1".into(),
        value: 1.0,
        offset: None,
        duration: None,
    };

    let data = ProjectData {
        tasks: vec![task(1), task(2)],
        resources: vec![ResourceData { id: "dev1".into(), capacity: None, calendar_id: None }],
        assignments: vec![assign(1)],
        ..Default::default()
    };

    let mut project = Project::new(ProjectOptions::default());
    project.solve(Some(data), &SolveOptions::default())?;

    let mut changes = SchedulingChanges::default();
    changes.assignments.add.push(assign(2));
    let candidates = [Candidate { id: "dev1-on-2".into(), changes }];

    let result = project.evaluate(&candidates, &EvaluateOptions::default())?;
    for c in &result.candidates {
        if let Some(scheduled) = &c.scheduled {
            let total = scheduled.overload.total;
            println!("overload {} ({:+} vs baseline)", total.value, total.delta);
        }
    }
    Ok(())
}
```

## Related

- [`Metrics`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/evaluate/metrics.md>) - the stage measurements that hold `Amount` values
- [`Shift`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/evaluate/shift.md>) - the date counterpart of `Amount`: a finish with its delta
- [`EvaluateResult`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/evaluate/evaluate-result.md>) - its `baseline` is where every `delta` is `0`
- [Evaluating Alternatives](<https://docs.dhtmlx.com/planning-engine/rust/resources-and-assignment/evaluating-alternatives.md#metrics-and-cost>) - how values and deltas are read when comparing candidates
