Submissions
Create, list, fetch, delete, and re-execute submissions from Python.
The client.submissions resource maps to the Submissions endpoint. Every method returns a typed Submission (or a Page of them).
Create a submission¶
submission = client.submissions.create(
name="from script",
fitness_func=(
"def fitness_func(ga, sol, idx):\n"
" return sum(sol)\n"
),
num_genes=5,
num_generations=100,
sol_per_pop=50,
)
Arguments¶
| Argument | Type | Default | What it does |
|---|---|---|---|
fitness_func |
str |
None |
Python source for the fitness function. Required for new (custom) submissions. Not required for quick types. |
fitness_func_entry |
str |
None |
The top-level name in fitness_func the runtime should call. The SDK detects it from your source, so you only set it to override the detection (for example, source with several top-level definitions). When you reference uploaded code with fitness_func_id the SDK can't see the source, so pass this yourself. Each callback has the same companion (on_generation pairs with on_generation_entry). |
num_genes |
int |
None |
Length of the solution vector. Required for new submissions; ignored by quick types that set it themselves. |
num_generations |
int |
100 |
How many generations to run. |
sol_per_pop |
int |
50 |
Population size per generation. |
name |
str |
None |
Display name shown on the dashboard. |
description |
str |
None |
Long-form description shown alongside the submission. |
submission_type |
str |
"new" |
Pick one of the quick submission types (see below) or leave at "new". |
webhook_url |
str |
None |
URL Vilvik posts to when the run finishes. See Webhooks. |
notification_email |
str |
None |
Email address Vilvik notifies when the run finishes. |
idempotency_key |
str |
auto | A unique string that lets you safely retry the request without creating a duplicate. The SDK generates a UUID when you omit it. Reusing the same key within 24 hours returns the original response. |
**ga_params |
any | None |
Any extra GA parameter (selection type, crossover type, mutation values, gene space, etc.). Forwarded to the server as-is. |
REST equivalent: POST /api/v1/submissions/. The body shape is the same as the table.
Quick submission types¶
When you set submission_type to one of the values below, Vilvik fills in the fitness function and parameter defaults for that problem. You only need to provide the input data the problem needs.
submission_type value |
What the run solves |
|---|---|
"new" (default) |
A custom run with your own fitness_func. |
"quick_binary_subset_sum" |
Pick a subset of integers that sums to a target value. |
"quick_knapsack" |
Choose items with values and weights to maximize value within one or more capacity limits (covers single and multi-dimensional knapsack). |
"quick_bin_packing" |
Pack items into the fewest possible fixed-capacity bins. |
"quick_travelling_salesman_demo_parameters" |
Shortest tour through a built-in set of demo cities. |
"quick_travelling_salesman_parameters" |
Shortest tour through a custom set of cities. |
"quick_timetable_scheduling" |
Assign tasks to time slots and optional resources so none clash. |
"quick_single_objective" |
Find parameters that best satisfy a linear equation. |
"quick_multi_objective" |
Optimize shared parameters across several linear equations at once (NSGA-II by default). |
"quick_multi_objective_nsga3" |
Optimize shared parameters across many linear equations at once (NSGA-III by default, for four or more objectives). |
"quick_2d_clustering" |
Group 2D points into fixed clusters by minimizing intra-cluster distance. |
"quick_sklearn_rfc_hyperparameters" |
Tune scikit-learn Random Forest hyperparameters against your dataset. |
"quick_xgboost_classifier_hyperparameters" |
Tune XGBoost gradient-boosted tree classifier hyperparameters against your dataset. |
"quick_svm_classifier_hyperparameters" |
Tune scikit-learn Support Vector Machine (SVC) hyperparameters against your dataset. |
"quick_knn_classifier_hyperparameters" |
Tune scikit-learn K-Nearest Neighbors classifier hyperparameters against your dataset. |
"quick_logreg_classifier_hyperparameters" |
Tune scikit-learn Logistic Regression hyperparameters against your dataset. |
"quick_keras_xor_training" |
Train a Keras network to learn XOR. |
"quick_keras_nn_training" |
Train a Keras multi-class classifier on your dataset. |
"quick_keras_nn_hyperparameters" |
Tune Keras hyperparameters against your dataset. |
"quick_torch_nn_training" |
Train a PyTorch multi-class classifier on your dataset. |
"quick_torch_nn_hyperparameters" |
Tune PyTorch hyperparameters against your dataset. |
The 9 non-ML types (subset sum, the linear objectives, knapsack, bin packing, 2D clustering, and the two travelling salesman variants) can be created over the REST API and the SDK today. The 10 ML types (quick_sklearn_rfc_hyperparameters and the rest) can now be created over the API and SDK too, using a built-in dataset: pass dataset_name as iris, breast_cancer, or random (the XOR type uses its own built-in data). Training on your own uploaded data is available on the website, but it is not supported over the API or SDK yet.
The hyperparameter types take a nested hyperparameters dict, with {"tune": True, "min": a, "max": b} to search a range or {"fixed": v} to pin a value:
client.submissions.create(
submission_type="quick_sklearn_rfc_hyperparameters",
dataset_name="iris",
hyperparameters={"n_estimators": {"tune": True, "min": 50, "max": 150}, "max_depth": {"fixed": 10}},
)
See Quick submission types for the dataset names, the hyperparameters shape, and the per-type fields.
For some types, you may pass the problem data explicitly or send a count and let the service generate it. Either way, the 202 response echoes the data actually used under a generated key, so a run is reproducible from the response alone:
result = client.submissions.create(
submission_type="quick_binary_subset_sum",
num_integers=8, # let the service pick 8 integers
target=20,
)
# result.raw["generated"]["integers"] shows the integers that were chosen
Each quick type accepts its problem-specific inputs as extra keyword arguments. For example:
client.submissions.create(
submission_type="quick_knapsack",
num_generations=50,
item_names=["gold bar", "silver bar", "bronze"],
item_values=[10, 6, 3],
item_weights=[[3], [2], [1]],
dimension_names=["weight"],
dimension_capacities=[5],
)
See Quick submission types for the full REST API reference with every field and its constraints. See Creating a submission for the UI-side quick problems guide, and Submission parameters for what every GA parameter controls.
Return value¶
create returns a Submission:
| Attribute | Type | What it is |
|---|---|---|
id |
str |
Unique identifier. |
status |
str |
One of queued, running, succeeded, failed, cancelled. |
status_url |
str |
Dashboard URL for the submission. |
result_url |
str |
Dashboard URL for the result page. |
name |
str \| None |
Name you supplied. |
description |
str \| None |
Description you supplied. |
submission_type |
str \| None |
The quick type or "new". |
created_at |
datetime \| None |
When the submission was accepted. |
request_id |
str \| None |
Request identifier. Useful to quote in support requests. |
raw |
dict |
The full server response, preserved for forward compatibility. |
is_terminal (property) |
bool |
True once status is one of succeeded, failed, cancelled. |
Fetch a single submission¶
submission = client.submissions.get("abcDEF123456")
print(submission.status)
REST equivalent: GET /api/v1/submissions/<id>.
List submissions¶
page = client.submissions.list(limit=20)
for sub in page:
print(sub.id, sub.name, sub.status)
if page.next_cursor:
next_page = client.submissions.list(cursor=page.next_cursor)
list returns a Page with items, next_cursor, and raw. Pages are iterable and support len().
REST equivalent: GET /api/v1/submissions/ with ?cursor=โฆ&limit=โฆ.
Iterate every submission¶
When you want every submission without thinking about cursors:
for sub in client.submissions.iter_all(limit=50):
print(sub.id)
The generator follows next_cursor automatically and stops when there are no more rows. See Filtering submissions and results for query filters.
Cancel or delete a submission¶
client.submissions.delete("abcDEF123456")
The worker stops at the next checkpoint. The submission moves to cancelled. Credits already used are still billed.
REST equivalent: DELETE /api/v1/submissions/<id>.
Re-execute a submission¶
Re-execute repeats a run with the same parameters, or with overrides you supply:
sub = client.submissions.reexecute(
"abcDEF123456",
num_generations=200,
mutation_probability=0.05,
)
Pass any GA parameter to override it. The new run is a child of the original.
REST equivalent: POST /api/v1/submissions/<id>/reexecute.