Skip to main content

G-FOLD: Fuel Optimal Large Divert Guidance Algorithm

Project description

G-FOLD Python Generator

This is the Python implementation of the G-FOLD algorithm with code generation capabilities. The problem is described using CVXPY/Python and C/C++ code is generated using CVXPYGen.

Installation

Option 1: Install from source

Prerequisites

You need to install Rust and Eigen for the code generation feature.

Clone the repository:

git clone https://github.com/samutoljamo/g-fold.git
cd g-fold/generator

Install the package in development mode:

pip install -e .

On WSL, make sure you've installed Tkinter (version depends on the python version you're using):

sudo apt-get install python3.12-tk

Option 2: Install from PyPI

pip install gfold

Usage

As a command-line tool

After installation, you can run G-FOLD from the command line:

# Solve the example problem with 100 steps and display graphs
gfold -n 100

# Generate C++ code
gfold -g -n 100 -o output_directory

# Save the plot to a file without displaying it
gfold -n 100 --save-plot --no-plot

As a Python library

from gfold import GFoldSolver
from gfold.visualization import plot_results

# Create a solver with 100 steps
solver = GFoldSolver()

# Solve the problem
solution = solver.solve(verbose=True)
print(f"Final mass: {solution['final_mass']:.2f} kg")

# Plot the results
plot_results(solution, save_path="gfold_plot.png")

# Generate C++ code
solver.generate_code(code_dir="generated_code")

Example scripts

Check the examples directory for more usage examples:

  • simple_example.py: Basic usage of the solver and visualization

Development

To set up the development environment:

cd g-fold/generator
pip install -e .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gfold-0.1.2.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gfold-0.1.2-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file gfold-0.1.2.tar.gz.

File metadata

  • Download URL: gfold-0.1.2.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gfold-0.1.2.tar.gz
Algorithm Hash digest
SHA256 229f5c278203f439e98b84569c49c9b01147c8a09f875fe98bfd89be432cfbaa
MD5 4ab230f3fae26255beea4778e1cd5fac
BLAKE2b-256 a76b030f640f48cbcd9b21921e8597f8040f4cdae9059537e87cfd8f0e125cb5

See more details on using hashes here.

Provenance

The following attestation bundles were made for gfold-0.1.2.tar.gz:

Publisher: python-publish.yml on samutoljamo/g-fold

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gfold-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: gfold-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gfold-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4b4c47b9915858b534f7d1bd5293f221e19ee402ad86526b5d68823a443dd441
MD5 d8118335823adf3ea3ef2c7e35ee988e
BLAKE2b-256 33101fcad144506d631e15ce386509e78c61930c41f4ceff8e87c2bc052af629

See more details on using hashes here.

Provenance

The following attestation bundles were made for gfold-0.1.2-py3-none-any.whl:

Publisher: python-publish.yml on samutoljamo/g-fold

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page