Metadata-Version: 2.4
Name: semistaticsim
Version: 0.6.1
Summary: Add your description here
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: ai2thor>=5.0.0
Requires-Dist: flax==0.12.0
Requires-Dist: hydra-core>=1.3.2
Requires-Dist: ipdb>=0.13.13
Requires-Dist: jax==0.8.1; sys_platform == "darwin"
Requires-Dist: jax[cuda12]==0.8.1; sys_platform == "linux"
Requires-Dist: matplotlib>=3.9.0
Requires-Dist: moviepy>=2.2.1
Requires-Dist: natsort>=8.4.0
Requires-Dist: networkx>=3.5
Requires-Dist: numpy==2.1.2
Requires-Dist: open3d>=0.19.0
Requires-Dist: openai>=2.0.0
Requires-Dist: polars>=1.33.1
Requires-Dist: prior>=1.0.3
Requires-Dist: scienceplots>=2.2.0
Requires-Dist: seaborn>=0.13.2
Requires-Dist: shapely>=2.1.2
Requires-Dist: tenacity>=9.1.2
Requires-Dist: tiktoken>=0.11.0
Requires-Dist: wheel>=0.45.1
Requires-Dist: hydra-submitit-launcher
Provides-Extra: dev
Requires-Dist: black; extra == "dev"

# Installation

Follow this [guide](https://docs.astral.sh/uv/getting-started/installation/) to install UV. 

The AI2-THOR simulation renders with Vulkan and needs the Vulkan loader (`libvulkan.so.1`): `sudo apt-get install libvulkan1`, or `conda install -c conda-forge libvulkan-loader` and add the environment's `lib` folder to `LD_LIBRARY_PATH`.

# Running it

To run the entrypoint, run the following command.

```bash
 uv run -m semistaticsim.groundtruth.main
```

`--config-name adaptive_exp` runs the adaptation experiment instead, where the objects' routine changes at hour 504.

You can set the target amount of simulation time to collect as well as the scan size. 
The bigger the scan size, the higher the RAM usage and jitting time, but it has the *potential* to go faster if you want to collect a lot of simulation time.

After collecting the data, plot the groundtruth of the first pickupable across all its valid receptacles: 

```bash
uv run -m semistaticsim.groundtruth.viz
```

To run the ai2thor simulation, you can use

```bash
 uv run -m semistaticsim.keyboardcontrol.main_skillsim
```

### Data paths

Both stages write under `generated_data/` in the working directory. Set `data_dir` to use another folder, with the same value for both stages:

```bash
uv run -m semistaticsim.groundtruth.main procthor_index=153 data_dir=/path/to/data
uv run -m semistaticsim.keyboardcontrol.main_skillsim mode=auto index=153 data_dir=/path/to/data
```

| Setting           | Default                                                         | Content                                                     |
| ----------------- | --------------------------------------------------------------- | ----------------------------------------------------------- |
| `data_dir`        | `./generated_data`                                              | Root of all generated data                                  |
| `object_data_dir` | `<data_dir>/object_data`                                        | Objects of each ProcTHOR-10k house, extracted on first use  |
| `target_dir`      | `<data_dir>/semistaticsim/<split>/<index>/<seed>/groundtruth`   | Ground truth (`groundtruth.main`)                           |
| `scene`           | Same as `target_dir`                                            | Ground truth the robot runs use; runs go to `../privileged` |

## How-to

Features are based around varying the level of scene-to-scene semantic transfer. Every simulator step, some dt time elapses. When the `duration_left` reaches 0, the transition model selects the next receptacle that the object will transition to. Then, the duration model sampels the amount of tiem that the objet will spend in that new receptacle.

Duration model:

1. even is "evenly spread duration of all steps"
2. instant is "spend NO time at this place, immediately transition at the next step" (this is what flowmaps currently has in your 2D simulator)
3. deterministic is "randomly split the day among all steps"
4. gaussian is the same as deterministic with some gaussian noise

Transition model:

1. "fixed_canonical": object cycles down a list of fixed receptacles
2. "fixed_0.1_0.9": object has 10% chance of staying put, 90% chance of going to the next receptacle in cycle  (this is what the 2D flowmaps simulator has)
3. "uniform_no_diag": fully uniform transition matrix
4. "uniform_full": fully uniform transition matrix
5. "location_weighted_uniform_no_diag": uniform transition matrix weighted by the ProcThor receptacle prior
6. "location_weighted_uniform_full": uniform transition matrix weighted by the ProcThor receptacle prior

### Preliminary scan experiments

 1. SCANSIZE 10: ~33.5 it/s : 335 steps/s
2. 100 : 33 : 3300


1000 : eta 50min

1000 : cpu: 3s/it; cuda is same!

# To build a package for PyPi

```bash
# bump the version in the .toml

uv build

# delete the old build in ./dist

uv publish
```
