Code Monkey home page Code Monkey logo

benezivas / algobattle Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 3.0 2.04 MB

Let teams compete by making them create hard instances and fast solvers for problems of your choice. Then pitch these instances and solvers against one another. All language-agnostic.

Home Page: https://algobattle.org

License: MIT License

Python 94.78% Dockerfile 1.04% CMake 0.15% C 0.03% C++ 0.04% Jinja 3.88% Smalltalk 0.05% Go 0.03% TypeScript 0.01%
teaching lab education docker coding-contest computer-science-education

algobattle's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

algobattle's Issues

Optionally pass additional information to solvers and generators

The averaged battle wrapper revealed the problem that it may be interesting for a generator to know in which iteration it is currently in, additional to the already provided instance size. Without this information, one cannot craft a generator that produces a range of different instances without relying on some random bits.

On the other hand, practice proved that a solver has to guess the instance size it is working on from the instance it is passed, e.g. by the biggest node label of a graph it was passed. Thus, the solver is at the mercy of the enemy generator, which can create instances with labels smaller than the actual instance size. Practically, there are workarounds for every problem (e.g. assume in the verifier that isolated nodes need not be listed for finding a biggest independent set), but explicitly passing this information should make designing problems much more comfortable.
Just like with the generator, the solver may also be interested in the iteration that it is currently in, if a team wants to implement a mixed strategy.

No battle is executed if one of at least three teams' generator or solver does not build.

If a docker container (either solver or generator) for one team does not build successfully, the complete battle is terminated. This is fine for at most two teams battling, but unexpected if at least three teams are involved, as the generators and solvers of the other two teams are not run against one another.
As this usually takes place when running first trial battles of multiple groups, it would be better to run the remaining battles and notifying the user instead of stopping the process completely.

Templating for creating a new problem

The templates for solvers and generators are useful, it would be nice to have a CLI option that does something similar for creating a problem.

I would suggest creating an algobattle.toml, filled with a placeholder project name as well as creating a matching problem.py file with the most common classes and methods pre-filled.

Inform user somehow that docker not being started results in a failing run

When docker is not running and one uses algobattle run, an empty results file is written. This is slightly confusing, since the program does not communicate what the issue is. It would be nice if either the cli or the results file would state that it could not connect to the docker daemon instead of failing silently.

End a Round prematurely after a generator has failed enough times in a row

A generator that constructs and outputs instances dynamically for a given instance size may not be optimized to run to completion in time if the given instance size is too large. In an iterated battle, it is assumed that this does not automatically disqualify the generator as it may well be randomized and produce output on the next higher increment.

I would like to keep giving the generator additional chances for higher instance sizes, but would like to advocate cutting it of after a given number of repeating failures due to a timeout.

Without this cutoff, battles currently run very slowly towards the iteration cap, as the generator is granted the maximum allowed running time for each step even if one can rather safely assume that no sane output will be generated for subsequent iteration sizes. My suggestion is to introduce a new configuration option that sets the number of tolerated generator failures in a row before the solving team is awarded its current iteration cap value. It should however still be possible to accept an arbitrary number of failures.

Building the docker image used for overhead calculation times out on initial build

The overhead calculation docker image fails to build when first starting a battle that enables these overhead calculations.
Building the docker image on the following runs works without issues after the initial failure to build.

This is reproducible on clean installations or after wiping all partially or completely built docker images from the system (e.g. as an extreme measure using docker system prune --all --force) using algobattle version 2.0.2.

The issue could be that the build time used for these overhead calculations, which is configured in algobattle/config/config_delaytest.ini is set to 30 seconds, which may not be enough for slower machines.

Access to other local docker images

Description

The Docker image that is currently built from the Dockerfile of the generator/solver can be based on other local images. This could enable one team to steal the code of the other teams in the build phase.

Example

The following sample could be used in the Dockerfile of the generator:

FROM solver-0

...

Instances are not modifiable after semantic checks in the verifier

When designing problem that need sub-certificate as part of the instance and not of the solution, it may be desirable to remove the certificate of the instance after it has been validated by the verifier's verify_semantics_of_instance method.

An example for this is the following: Assume you want to pose a parameterized problem, such as restricting the vertex cover size in a given graph for solving a different problem. The verifier then needs to be quickly able to verify that the given graph indeed has a vertex cover of this limited size, which is easiest done by providing a concrete set of nodes as the vertex cover. However, as the verifier only returns a boolean value whether the instance is semantically valid, this concrete vertex cover then cannot be removed from the instance afterwards. Afterwards, a cleanup method of some kind should be invoked.

UI does not correctly display multiplayer battles

When running a battle with the --ui option that runs between at least two teams, the ui only renders one pairing.

Example:

battle testsproblem --generators=testsproblem/generator,testsproblem/generator --solvers=testsproblem/solver,testsproblem/solver --team_names=foo,bar --ui

Output:

Battle Type: Iterated Battle
╔═════════╦═════════╦══════╦══════╦══════╦══════╦══════╦══════╦══════╗
║   GEN   ║   SOL   ║  R1  ║  R2  ║  R3  ║  R4  ║  R5  ║  CAP ║  AVG ║
╟─────────╫─────────╫──────╫──────╫──────╫──────╫──────╫──────╫──────╢
║      bar║      foo║     5║     5║     5║     5║     5║     5║     5║
╚═════════╩═════════╩══════╩══════╩══════╩══════╩══════╩══════╩══════╝

The logs state that all battles actually run (in this case, the battle in which foo generators and bar solves). This seems to be an issue with the ui rendering only.

Non utf8 output crashes battle

Description

If the generator or solver outputs bytes that are not a correct utf8 sequence the battle crashes.

Example

Example generator that crashes the battle:

import sys

sys.stdout.buffer.write(bytearray([0xc3, 0x28]))

Note: 0xc3 0x28 is not a valid utf8 sequence

CLI command "algobattle package problem" throws empty error

The named cli command behaves a bit curiously, and I have trouble understanding why. If I take the circlecover problem from the algobattle-problems repository, descend into the corresponding folder, and run algobattle package problem on it, the cli behaves as expected, and packages the problem.

I do however have trouble packing other problems, where the cli is not very helpful in its feedback:

~ algobattle package problem                      
Couldn't load the problem file
Error: 
Aborted.

An example of this is the longestpathboundedfvs problem from the algobattle-problems repository, as well as problems that we currently build ourselves. Since the error message is empty and the structure of the problem files looks virtually identical, I cannot identify what exactly is causing these issues.

Add CI checks for macOS and Windows

Towards officially being compatible with the two operating systems, tests and mock executions should be covered, similar to the ci currently implemented for ubuntu-latest. Ideally, workflow status badges should be additionally added to the README.md to more easily communicate which operating systems are supported by the current version.

It would be completely fine if the current code still fails on these other platforms on the CI pipelines and a good preemptive measure to easily verify if future pull requests actually solve compatibility.

Limit number of instance/solution lines for a given instance size of a problem

A malicious actor is currently able to flood a parser with an instance that consists of "legitimate" lines, which have to be filtered out by the parser. This is noticeable if the parser is running in linear time, but once more complex parsing is done, this may significantly slow down the run of a battle.

A possible solution would be to give a problem object a default method that can be overloaded by specific problems. This method(s) returns the maximum number of expected lines for a given instance size, separately for the instance and the solution. If the output exceeds this number of lines, it should be either truncated or discarded altogether.

Minor bug when dealing with Self-Edges

When algobattle encounters self-edges in problem.py (in the 5-shortest-paths problem), it states that the number of nodes is too small ("type":"ValueError","message":"Cannot run battle at size 6 since it is smaller than the smallest size the problem allows (7).")
despite the fact that in certain instances, there are technically at least 7 nodes present.
Here is an exmaple for an output where the error is thrown:
{'num_vertices': 9, 'edges': [[7, 4], [7, 2], [7, 0], [7, 5], [7, 8], [7, 7], [4, 5], [2, 5], [0, 5], [5, 5], [8, 5], [1, 3], [1, 1], [1, 6], [1, 5], [3, 1], [3, 5], [6, 3], [6, 6], [6, 5]], 'edge_weights': [79, 55, 85, 94, 96, 653, 88, 71, 89, 52, 74, 6, 9, 5, 395, 7, 1756, 4, 2, 1020], 'start': 7, 'end': 5}
{'paths': [[7, 4, 5], [7, 2, 5], [7, 0, 5], [7, 5, 5], [7, 8, 5]]}

Pydantic annotations using instance attributes seem to be ignored

We have designed a problem for packing a 2D Knapsack as full as possible. Here is a snippet from the problem.py:

Number = SizeIndex
lengthItem = Annotated[int, Interval(ge=1, le=InstanceRef.length)]
widthItem = Annotated[int, Interval(ge=1, le=InstanceRef.width)]
Point = tuple[lengthItem, widthItem]
lengthPosition = Annotated[int, Interval(ge=0, lt=InstanceRef.length)]
widthPosition = Annotated[int, Interval(ge=0, lt=InstanceRef.width)]
rotation = Literal["unrotated", "rotated"]


class Instance(InstanceModel):
    """An instance of a 2dKnapsack problem."""

    length: u64 = Field(ge=1)
    width: u64 = Field(ge=1)

    items: list[Point]

    @property
    def size(self) -> int:
        return len(self.items)

Do note the items attribute: It is defined as a list of Points, which themselves are a tuple with members lengthItem and widthItem. These two members are defined to each be in an interval between 1 and InstanceRef.length.

This last guard seems to be completely ignored. Students are able to pass items such as (0,0) and to exceed the implicit guard of u64, of length and width.

Is this a problem of the concrete way we annotated these attributes?

Error messages usable to expose generator instances

If a solver crashes during a fight, the JSON file containing the match results displays a corresponding message for that fight. I was able to influence what exactly that message contains from within the program.
The Solver used for the demonstration is written in C++ and solves the Pairsum problem. At problem sizes greater than or equal to 100, instead of solving the instance, it throws an exception that escapes the main method, crashing the program. The message of this exception contains the instance that was given to it, formatted in JSON. Given below is a result from a match, where this modified Solver was used.
This demonstrates that it is possible to encode a problem instance (or any other sensible information) in match results. I suggest one of the following actions:

  • remove the message (or rather the detailed description)
  • make it not customizable
  • point this out to possible organizers using the framework, so that they can decide if this exploit should be allowed or not
  "active_teams": [ "team0" ],
  "battles": {
    "team0 vs team0": {
      "fights": [
        {
          "score": 1.0,
          "max_size": 4,
          "generator": { "runtime": 0.03 },
          "solver": { "runtime": 0.04 }
        },
        {
          "score": 1.0,
          "max_size": 5,
          "generator": { "runtime": 0.03 },
          "solver": { "runtime": 0.03 }
        },
        {
          "score": 1.0,
          "max_size": 9,
          "generator": { "runtime": 0.03 },
          "solver": { "runtime": 0.03 }
        },
        {
          "score": 1.0,
          "max_size": 18,
          "generator": { "runtime": 0.03 },
          "solver": { "runtime": 0.03 }
        },
        {
          "score": 1.0,
          "max_size": 34,
          "generator": { "runtime": 0.04 },
          "solver": { "runtime": 0.06 }
        },
        {
          "score": 1.0,
          "max_size": 59,
          "generator": { "runtime": 0.04 },
          "solver": { "runtime": 0.05 }
        },
        {
          "score": 1.0,
          "max_size": 95,
          "generator": { "runtime": 0.05 },
          "solver": { "runtime": 0.05 }
        },
        {
          "score": 0.0,
          "max_size": 144,
          "generator": { "runtime": 0.06 },
          "solver": {
            "runtime": 0.06,
            "error": {
              "type": "ExecutionError",
              "message": "The program executed in the container crashed.",
              "detail": "exit code: 139, error message:\nterminate called after throwing an instance of 'std::invalid_argument'\n  what():  {\"numbers\":[4,6,8,4,5312107441570174180,3775268697219512025,3439068402814167443,3828736714298749362,4929687381881644035,4214980285811685407,8388800872610662665,4704031994606907830,4124731036174800054,8291131817934932319,7106365444072478678,5805353179021452580,3353134748950241369,2210316706841196790,59889903456928165,1115623253311126309,540081061778675713,5764736901160952322,7843013307931874357,4613389947810874004,2701470550665538010,5887634002242957611,4293358826107258258,5792959087227831708,1341900449473654997,8770615531586855138,3827504222110430091,3822206095539349389,4318080441268291122,2647603355424688176,7162919519700802339,5971787460277761394,3372256969491294602,8009435000026676914,1078508601136675,71009715189567693,5022608456250052421,3505247142810084311,5780877801202253887,8661282154359021067,763306818994239927,8218812138625904881,6475822155233904304,938413865957918876,5178948887922366312,3089336876513575729,5841718909130211505,4447837793742821911,5212679793821756385,3034408967193895607,8105790982988546399,6725959332704131818,1638586714520480229,9006138423117694435,3812189018855067119,5347693509292162159,3664116821593727985,3085238218679206765,3134697163270978598,8641506682647432438,3605493742092656398,1305613092523457422,197969188498923990,1378514312042848960,7348275270349805408,1517525579893842212,5902841020995155122,2316859310560131240,6348268434305064334,8544951880082888744,13320249600110722,7196226143430534344,4387921744888742018,1262709226199407845,8322159032987789719,3511376047389044913,3364332091873615936,6797443505836050954,2451206629308815481,7654647785204145065,1063219533876568333,8611934445311444647,6781346136718920569,5216747126164831528,1594519032004783608,7645746091046744827,3715291270225236513,5266262156426522312,1748713889658129755,832267303636214775,3048682451321404666,2567219791183855772,4668458760910366373,2451618660804970193,6939963558749140726,7764367993022516602,8170163594527047037,3137739819087517667,3613650029889051010,8927803312466163298,5173511594268115415,4229711837984930416,5840968504599263562,2771022791368954474,2316919918443399296,4994803968255357732,4385255888974946647,505554787960531169,520819244992424898,2543481756514643215,1825796515031377833,4532073146284415067,6288225330212453834,489560089664418181,8805476891781325989,5943894379213896619,6936013212867366757,312930899637656123,6191226013838515469,7061620787372571813,4829891484647498059,8541428537058199074,3635534172580630294,2008718888898224235,7335338743324203310,3628743094383385300,5719483942140319839,182253900686136429,5204494261569601018,3793241493192283533,634427855913161084,6962657641651888672,7559944157890606421,1663064694412258873,856171051554792939,4184522022148941183,733619936073527163,4573133197808852912,4022858498740611211,4162315427663698390]}\n"
            }
          }
        },
        {
          "score": 1.0,
          "max_size": 96,
          "generator": { "runtime": 0.06 },
          "solver": { "runtime": 0.06 }
        },
        {
          "score": 1.0,
          "max_size": 97,
          "generator": { "runtime": 0.05 },
          "solver": { "runtime": 0.05 }
        },
        {
          "score": 0.0,
          "max_size": 101,
          "generator": { "runtime": 0.05 },
          "solver": {
            "runtime": 0.04,
            "error": {
              "type": "ExecutionError",
              "message": "The program executed in the container crashed.",
              "detail": "exit code: 139, error message:\nterminate called after throwing an instance of 'std::invalid_argument'\n  what():  {\"numbers\":[4,6,8,4,5139032607712065573,3716406520396823391,3189846272052814891,6142045344534315752,2710648405376610817,8062546390200776802,4462610392524079662,767372508048099254,2716590816286078601,4560120713655230972,50468060533222223,6032246208155694077,5665461412647347000,2367021845783607236,4433988627668984794,8850632776130544201,1024115687402789998,3141067486486716031,3671068609628865956,5761243076611874587,5295385314729327766,7418000228107817253,2907447182122580595,8630454198267515889,2975769698922809025,197894191751213602,8585800114677057666,4266617418782151973,1274385260201797870,3777967391531915051,4836953980009275318,2300233649007721019,16591459594352275,3675274073588475709,1224289133115768012,5668073922322154493,1947297462057348164,1293982678488782831,2719487515270649858,1035675503995915694,4353491176985801823,1841650781249495645,4030493646095564515,7267688577135546738,7231371244327993653,4567894227344583923,3507932141500164828,6944395512547522614,8718637662032611811,4494610414312543524,6747861619820569018,6713464888278810307,58069824300128610,163716196414639140,3891648816147918223,1837646068587098680,3774445124347694001,4949943832433403004,6844602148413060840,7209664962636168502,1816853823629795665,9099606198230851209,1941210002684053991,5018874436990309406,5293679085369501598,2452145139160280553,6107590060868038204,8665160480585774522,8721605263013858250,2856669461359488724,6123069298358498935,7479661594189549001,7825617548341684992,5797393121166760986,6479759626286974976,5559342116477742312,2677549743838267549,8365141280649901168,1432038085279309163,3912763499908710588,8112054994547442560,2958059472045937593,229755128629156343,3869989178057562134,1516303114482764085,7961704056194151495,1894857731681281510,3168106297948560808,7485586380487225531,5166232820250703696,4206727631325895465,1145415789375062874,5828247973570767106,7133301649378149261,5131779818389593118,7083102953431347122,959873971176983437]}\n"
            }
          }
        },
        {
          "score": 1.0,
          "max_size": 98,
          "generator": { "runtime": 0.07 },
          "solver": { "runtime": 0.18 }
        },
        {
          "score": 1.0,
          "max_size": 99,
          "generator": { "runtime": 0.06 },
          "solver": { "runtime": 0.04 }
        },
        {
          "score": 0.0,
          "max_size": 100,
          "generator": { "runtime": 0.04 },
          "solver": {
            "runtime": 0.04,
            "error": {
              "type": "ExecutionError",
              "message": "The program executed in the container crashed.",
              "detail": "exit code: 139, error message:\nterminate called after throwing an instance of 'std::invalid_argument'\n  what():  {\"numbers\":[4,6,8,4,6029421602870773377,4817246413896212826,2919759021996498015,6641553262522369455,2203062391120620247,5300902688320218582,7456419657658702437,2671448804494668063,1050152351988305463,7786415555252505221,8722307993302505059,1179979210798844996,2927470592755760446,4562035415511063784,3986359926332640576,500360013849263958,2561163658539097076,599502104433129868,162520733969405296,2997028284887266247,1220824723383770111,6618708133222910880,3455215093883030211,6574902700499838746,8203796388014434788,8219716408858391025,4029235373576419796,1062879602617641017,7666941968442979758,2305723401467740104,2095082103255883772,6469239971252015496,4453717796346568796,2338933776478002132,7328530835882220136,4875069867745449836,2872765844291678213,9091693663645290211,7856172759250992558,5488833880108165564,5095856575441064763,3415996089314104052,4373218348838260217,617218577961263015,5447493942808804517,2476668424885769371,3822910159253741056,3970410682513022789,268824837080989410,2373297822236122991,8120446621108338938,6524265698633931285,978998950515944162,5736767954340383889,1197036694616757613,2356108239158169281,1193225996393393145,3180806115787949745,9014308796972792788,5005664968440744600,258749189517427418,6203477019139018215,8946156082162692719,5368839479582869504,2136863662561656096,7096164355724579194,5708832905896613974,6440554016901624687,3613605385741192784,7733359226779113736,2572810337378526666,5893106033681567730,1675834753846943390,8912751597735766672,5643463585311811329,4040477647308441102,6007010949158920349,8658139666996535066,405495959080815448,2585566193095222055,1925100218124998721,3185446873679738793,1378798546939769776,557435353504383490,2188051232046977722,6721761298556341932,513099550931899231,8162861511940853775,1230366272685689759,357469476461443068,8387760298258896535,2919172439998431317,7089644659879990426,5713180723677213689,8530990609598242691,5425304059518403094]}\n"
            }
          }
        },
        {
          "score": 1.0,
          "max_size": 4,
          "generator": { "runtime": 0.04 },
          "solver": { "runtime": 0.04 }
        },
        {
          "score": 1.0,
          "max_size": 5,
          "generator": { "runtime": 0.04 },
          "solver": { "runtime": 0.04 }
        },
        {
          "score": 1.0,
          "max_size": 9,
          "generator": { "runtime": 0.04 },
          "solver": { "runtime": 0.04 }
        },
        {
          "score": 1.0,
          "max_size": 18,
          "generator": { "runtime": 0.04 },
          "solver": { "runtime": 0.04 }
        },
        {
          "score": 1.0,
          "max_size": 34,
          "generator": { "runtime": 0.04 },
          "solver": { "runtime": 0.03 }
        },
        {
          "score": 1.0,
          "max_size": 59,
          "generator": { "runtime": 0.04 },
          "solver": { "runtime": 0.04 }
        },
        {
          "score": 1.0,
          "max_size": 95,
          "generator": { "runtime": 0.04 },
          "solver": { "runtime": 0.04 }
        },
        {
          "score": 0.0,
          "max_size": 144,
          "generator": { "runtime": 0.04 },
          "solver": {
            "runtime": 0.04,
            "error": {
              "type": "ExecutionError",
              "message": "The program executed in the container crashed.",
              "detail": "exit code: 139, error message:\nterminate called after throwing an instance of 'std::invalid_argument'\n  what():  {\"numbers\":[4,6,8,4,470194469658590101,2973979889687967883,144561606759963709,2719837766732409482,3452812588151318819,4326732242307896527,2087263110764009396,534498963065135617,4355176418647220392,3059528842794075835,3811721497034749288,7080254452069985006,485932646713586169,2511092091857195191,5553051214389951137,3007959092328048192,5640824402223338586,2482461975116576441,2017645227503994315,294190266395598150,6196555507474621454,5943365967018742287,445899178599377629,7744185425180368141,5925409309943349516,1514447023451306801,8946083027089441475,3155431940508044277,9002719006785068383,2900188606744735656,314203877888251562,3526848394735990210,637913246749993954,4761234522324858963,3026901366281323058,1371056229313827217,4422419702430316622,2935782301842920900,6937580440314577258,7917842255195825545,5409354303940351477,3738404379733754732,3407031606738292693,7983662940109074126,7015536236812077922,7289835965536575779,9182394872855187018,5159421170658882748,3058756253514736853,4637754212552399287,8205222944915080615,9009339885862577287,889841780258728769,5297773638898560719,8970561271612084766,420405236480024374,1155343698367861090,3548574242315156110,9190167966779684469,7288614639854916205,2141577858024442700,1072212540288631953,4605217625625561556,1359982010712351473,8963721411861904045,260464880245936318,4888332393391499763,8427866576428309256,4853142559408112767,4020868040556395441,6596009383415263666,4564298114897332558,2060448403633315407,8567901359946997513,3807006383368759280,7662649553208015747,793536287656156564,8452542561786876117,2179338033657953625,6369589104974998433,7313730509533893986,6625355621806849019,821091045294848605,3401264642879568156,3017068588081891385,6604007217744159,4203099748977302287,3739853342468899200,5201237821989841719,6554244278045988650,424212735586556707,1711803068340306758,7725681439089133138,9006378607990740602,8602362750162362816,2907834267233249105,3069460832704310047,8528464529110302176,7848959633980729102,3673802478397631687,5625671426929338626,2360962144476581166,380744303394769767,5006290210214747158,7476754912914772136,5835407420120093144,4934567545468241304,2985735044361868138,2163085765116391295,779250111742716846,6203339920673667190,2043386384626674052,4554695078221993697,5804023129448502287,2550769920628300279,2142823620035296338,7907050067999198164,3383586625134981385,1996695966493642823,4723570145229357272,4265473728272084127,7671633692171595858,7777741214671438764,5464050155483144339,2375202878145333234,175460793921302368,1446536047711523090,9086737751089418401,1781206511069084555,4947836614980451618,3200366640993811539,8073778203846014187,1387353100421337349,7106490460814487212,8310183863632393637,7474791150292684487,4313169323604767533,3590508543477453036,8126737718609256173,6408846647519936307]}\n"
            }
          }
        },
        {
          "score": 1.0,
          "max_size": 96,
          "generator": { "runtime": 0.04 },
          "solver": { "runtime": 0.03 }
        },
        {
          "score": 1.0,
          "max_size": 97,
          "generator": { "runtime": 0.04 },
          "solver": { "runtime": 0.03 }
        },
        {
          "score": 0.0,
          "max_size": 101,
          "generator": { "runtime": 0.05 },
          "solver": {
            "runtime": 0.04,
            "error": {
              "type": "ExecutionError",
              "message": "The program executed in the container crashed.",
              "detail": "exit code: 139, error message:\nterminate called after throwing an instance of 'std::invalid_argument'\n  what():  {\"numbers\":[4,6,8,4,4432155195256657058,2738061025317232007,1921906393809041932,6466683977438284485,8808782119495455539,6426216317539298774,5377539488995012550,2896283600137596053,7589237470483518716,1385739364479000539,368410173785468010,4352048896392725606,7931786184794186699,4711975826263536329,6822266810985364945,8488214223453669285,1564192939946984953,4892286042309840789,5834481024911109186,8127765576924517383,7322420281726182876,3455411027478540604,1720877972043327152,3077559331524265586,8021621664284370694,3240574591766094605,7660138148418357821,879919206311930801,4471720651390075036,8533416530165979506,757453418413698802,3857512616528334250,432570199404183588,9001569874436809861,7245661425761013617,8880435568325892336,2448560780396413960,2587104625574015329,5060679428916617264,6390454762440332927,2351140234158625804,826422952085964414,5689560634440477274,2619064513235948900,1843956780158446512,4650579683081881483,4612524870962596422,2183836390961614366,4463510789544741665,8073062958529148629,5343833657522942758,26884683437829688,1617049311441965574,2620921118484110363,9177374309057782975,1332432213658886682,4473956138585999732,6918931938031668177,5558692334232512845,6565239718959358814,1930734608509852442,2511377612988974201,1163459277927742695,2416859267636688356,9039557005581201994,3042506662082402594,1591644256009416743,4522834937216081854,6182882019514485098,7811488821993037892,5716914909052876891,8695102902860249463,3336686294484941436,6508791132605205325,8163601092282884630,2119876907036478995,5254253419159693596,5164937767857776,5214965221584547032,5388737354507458416,3874928919871757572,7390096141851168078,993274053072994040,2690550366357475624,5259626847057479315,1906782674530012059,6439549799366285953,6123751549882998301,6386835739648864538,5153265136212644396,250362906703981127,5198997829178037071,8572335012334471133,3475986083492812646,4289529711561578306,7751531634470502252,7994265948264978591]}\n"
            }
          }
        },
        {
          "score": 1.0,
          "max_size": 98,
          "generator": { "runtime": 0.06 },
          "solver": { "runtime": 0.04 }
        },
        {
          "score": 1.0,
          "max_size": 99,
          "generator": { "runtime": 0.05 },
          "solver": { "runtime": 0.06 }
        },
        {
          "score": 0.0,
          "max_size": 100,
          "generator": { "runtime": 0.08 },
          "solver": {
            "runtime": 0.08,
            "error": {
              "type": "ExecutionError",
              "message": "The program executed in the container crashed.",
              "detail": "exit code: 139, error message:\nterminate called after throwing an instance of 'std::invalid_argument'\n  what():  {\"numbers\":[4,6,8,4,7673727473145201378,1636656189778641030,2695159372918803532,980867258284058682,2349503089624920014,3592949575107048426,8625307816693072573,2989718139601980116,770929694671133419,6572859807251956611,3597657982667001882,4168199153739971603,1859267720183935237,535063164647830500,1676667707649417243,2574426607086388216,9166657987769342921,7644189934434222819,9069771086956859840,24191897499936081,3677891066962515971,4620589688776525651,6862220264152581687,6662675016647528984,1206437253059483083,4998319956392696432,2649520591856646224,3408184154126941112,7863417012517607108,2750246648344760622,220525587359906085,7707480365571653490,4443996292218859431,3872567610363851857,8009717953992520437,4694804268254237352,3813805348109278167,6275508758912234138,4162398178224135759,4638983952137613269,308575812673185066,8228118730568086826,726065574211966592,1474762211478807972,2846183278577412295,3063480192687171327,6644604542035014193,8540861793502632780,1846716855640977864,4548875562665680212,7754731864789948991,4018533393938286446,804053674075563620,7250252584980563171,3770380630023857116,1433223999201941059,734274834575184422,3402832553142467261,3142001582426678945,3924428570720087863,5191670565074998000,4762824842305723978,7621449599548653859,8779130806878237570,4720116739343846631,567507770235052548,202962656532961251,5633332042130915605,1287367523704163861,293947697231779282,1247339576318081410,895717050139149240,2406299095375293623,4088031881414918631,4494334094328162514,6234657352111013028,3283316478430411235,862527830130613347,4202305002725367341,6006423988625451045,4808942986623660005,3382861493180104864,3220481117856143910,5715312959248274964,2394295575887460919,8203146301276209381,8328231501032310822,4907232833958482373,7614494279554969951,5174897495478728094,7763887348269327789,3369315088603652208,4452510294825107689,8048198228285522531,8354124127386615253,5826383542070241523]}\n"
            }
          }
        },
        {
          "score": 1.0,
          "max_size": 4,
          "generator": { "runtime": 0.07 },
          "solver": { "runtime": 0.08 }
        },
        {
          "score": 1.0,
          "max_size": 5,
          "generator": { "runtime": 0.07 },
          "solver": { "runtime": 0.08 }
        },
        {
          "score": 1.0,
          "max_size": 9,
          "generator": { "runtime": 0.08 },
          "solver": { "runtime": 0.08 }
        },
        {
          "score": 1.0,
          "max_size": 18,
          "generator": { "runtime": 0.06 },
          "solver": { "runtime": 0.1 }
        },
        {
          "score": 1.0,
          "max_size": 34,
          "generator": { "runtime": 0.06 },
          "solver": { "runtime": 0.05 }
        },
        {
          "score": 1.0,
          "max_size": 59,
          "generator": { "runtime": 0.04 },
          "solver": { "runtime": 0.05 }
        },
        {
          "score": 1.0,
          "max_size": 95,
          "generator": { "runtime": 0.04 },
          "solver": { "runtime": 0.04 }
        },
        {
          "score": 0.0,
          "max_size": 144,
          "generator": { "runtime": 0.04 },
          "solver": {
            "runtime": 0.04,
            "error": {
              "type": "ExecutionError",
              "message": "The program executed in the container crashed.",
              "detail": "exit code: 139, error message:\nterminate called after throwing an instance of 'std::invalid_argument'\n  what():  {\"numbers\":[4,6,8,4,3992919049384011717,4160917147651449213,353343036498977080,7653474039149518585,6325772374010169416,5877613099959748369,7275267746236525949,7967626315572413215,7559335494725164687,37192535250178465,1917773402908302955,5947795584608603582,6109509743359997511,5886024495407840214,5267619308738275517,3690549105041804064,3345083267266199282,872525204458052994,1366744494296598424,5061014152246199692,446193557552025369,3980161938577565974,5566128222854933360,1862091529791831342,6405762567868589978,701433530156776572,5496341754975740620,2904460735218933951,6277938440773373580,1308319718373766734,4485013746362854457,3326988339057423234,1825036586451561756,6312454394822103723,4443491640369599612,978024767861815412,3942986733633979821,3029043970475314267,2022699366912672254,3515886167190395451,8388080032163969314,691953716229173932,4315543771122795554,8108548907140625767,7424802492344338262,4772132401245416873,8381236221462398933,6113568181543577873,6975257749146673142,5184286020915968220,2452882433089750980,3943547883644218761,2859904842221811107,3378560397426393427,4731682382706282389,1592356441297797948,5179644473623684602,7488651889403184570,8545246688425727464,2668495592237471414,7261702597826478747,6255798740659024586,7943060625874187973,6497464750487223980,3033478686997370886,7602523594977897483,3147572457391145055,6167904312027545802,885864677518131001,7499194144957736582,6719725369116602934,1100501812499269984,3243699023288239305,6034435236901481938,6416667532484774806,8757887675390932013,373161782975188266,8599520556682722475,5525851853990924488,2682601500237903808,7663899637411723306,3622649544213554532,5800369342987103070,6299374260120770648,1836810534785037216,1716893389054855530,2021486216393582620,6817987202894059305,524743711699472457,6498885941554028357,6047772264344125772,2915993961834536733,4451296623619999323,5960333431608804729,3264239542939047342,8418564560196137759,3506416415230858472,5602363663068055306,8789779082271012334,7925534707918090762,326603605472562625,7925916188856392402,1770001564634886877,6182300797449731755,5027711917656436072,959761111198687356,5899556106962639932,2862773764945243803,8795012055914832834,8251915192517065108,519503461997722375,2998098768272546208,8429415473329434591,1697170077901955459,730783596240073811,1715190440667330038,2544084712442045899,7036759764113935067,1763432076547901189,3015114785053844013,4398161275277847923,2116405368593167257,1030050760379046946,1641440413142122088,6643215818230510107,2811824041652123643,2420654309096849740,3908910831239199799,4635390411312698445,3108526860032414531,3874247169996605462,2408897424468029102,3209605417465125578,8677139343069175203,3663435513135818342,9150045158662877603,1737779338117303967,1152907070024008445,1376439430705146761,5028102426024850566]}\n"
            }
          }
        },
        {
          "score": 1.0,
          "max_size": 96,
          "generator": { "runtime": 0.04 },
          "solver": { "runtime": 0.04 }
        },
        {
          "score": 1.0,
          "max_size": 97,
          "generator": { "runtime": 0.04 },
          "solver": { "runtime": 0.04 }
        },
        {
          "score": 0.0,
          "max_size": 101,
          "generator": { "runtime": 0.04 },
          "solver": {
            "runtime": 0.04,
            "error": {
              "type": "ExecutionError",
              "message": "The program executed in the container crashed.",
              "detail": "exit code: 139, error message:\nterminate called after throwing an instance of 'std::invalid_argument'\n  what():  {\"numbers\":[4,6,8,4,543097347488938325,3084762363394676212,4282284273617314333,4414421051364673706,177571464650131852,5621567214037086741,3944268356435124327,4021193758957586420,6082253872815046888,178056243762436359,4398518512058704746,1121421205930738251,4917838132221112004,5760789367873957964,4778485800760236562,6851003905464286877,7607535110439532602,1585761357588451190,812626434659601404,2588419786823411849,1638531311825302674,2592023079453269151,5377037954004429824,3329743238072815276,1071639585829059245,8476430242076386326,8151072353771513126,7835603466101976884,4303755206440270401,3010255229863859031,3851113250128628045,8722232178103564210,8087948384492013861,2797919293272588096,1441019798731031985,359541415169204706,4129440715990356858,2979006721069647458,7633397234452237552,3259579705030603561,651145973359106745,8983198399876800,4453195758121382214,7402166414711968915,8165396035527969161,1579643752965683656,7642875889996310400,1076854327526838923,2865102553766220203,4721221321794364574,7786633066857381216,2980606447545994737,8007630519384760733,3703610116550601632,4370474973274379228,1225625908234993941,3650904425025371663,398282513638090814,7258890655153185986,1562122712579981386,2972407337022788074,7596563350887293247,2872219360252406014,7319636054039911077,149341565656797184,232218445310724480,9141445511774580975,597155217813263125,8386605086569788971,7789736092776231487,7317926063909850850,1447098696420855701,4458470863061091790,4358175655470501110,7800435900842713056,4762444450085231326,3272772779211755419,3378346109797773113,3087041419739213527,7294978989412011824,4791408315228174060,5900650302969545283,7712416346228577406,72008878519980479,4054576667915796548,1175655068465686387,4622627622749781223,8154196256848094481,1148499523944307087,7768463081712698010,4114130428838577739,657538029431999910,9181514826914425285,5683244570261893598,6208364837378191896,4508896485199062855,4727039132104927956]}\n"
            }
          }
        },
        {
          "score": 1.0,
          "max_size": 98,
          "generator": { "runtime": 0.04 },
          "solver": { "runtime": 0.04 }
        },
        {
          "score": 1.0,
          "max_size": 99,
          "generator": { "runtime": 0.04 },
          "solver": { "runtime": 0.04 }
        },
        {
          "score": 0.0,
          "max_size": 100,
          "generator": { "runtime": 0.04 },
          "solver": {
            "runtime": 0.04,
            "error": {
              "type": "ExecutionError",
              "message": "The program executed in the container crashed.",
              "detail": "exit code: 139, error message:\nterminate called after throwing an instance of 'std::invalid_argument'\n  what():  {\"numbers\":[4,6,8,4,8131140123250275237,786268530846450528,288808195845659622,4214074723529652806,1659622431003095433,7598728435912573235,3870531669962466840,8146988116650530215,3476592327218567878,99500881363551110,7641499497970153872,5205406387153414294,598692434854292117,3884168031489510255,3341272972115306749,4354071782742583427,4443044932272125163,174819514231405694,3291267146026778797,7202624936217729592,4207110727812516153,2750900925510081367,7247376703386434318,1050731932340995136,7727341011829254949,7176128919095219340,863424975514891209,5544379139756805252,3065487597031084728,7386289530563891787,7490265529921711161,5440835802015993845,8415682597754231519,7810096110332929381,15879988287789268,6719488159128483908,4893984239417870458,7588897501690331,6636031292735858793,4858247600398310068,2180485944192307566,7675774746426314856,9152025866884077999,4708959984119353736,2183452020512563052,2064165502579731926,5455389169253966541,2656068222458470362,215994971919240644,501076778549230805,4641902570209529451,2187040148169504908,8923291234384694105,8831383697935505939,5131250792970243344,8042112190047309456,1103516082819957095,6792844691835517394,2942070293743512170,7621460814398506420,3521573503698101115,8605164169653006954,6137038362832269756,835818318687981741,5211961362792028428,3812765451043655494,5106865860635395662,5099148402603679357,3273861343115950108,3552577667827382326,2100722844442171857,3139623499938306393,651834241899222454,7122020851122900506,5839776141765554243,6494892792441075201,442489007645981815,2758777275148092268,4951371486640657316,3515799911979869261,1180672527488397776,928314810999950539,8545245013101786920,5361905666057202929,2990802085958453377,1088633028969687135,1400390294788361483,3721452998300865358,5815429042468283458,4600054250190439680,6622691527865692713,6561439769004972814,7133338417668108819,4122053466343410792,7888499315961949800,6032098117044900276]}\n"
            }
          }
        }
      ]
    }
  }
}

4.0.0-rc: Saving logs to file not possible

When calling the algobattle script with a file name that does not yet exist, this is not accepted:

algobattle git/algobattle-problems/algobattle_problems/pairsum --result foo
usage: algobattle [-h] [--config CONFIG] [--silent] [--result RESULT] problem
algobattle: error: argument --result/-r: invalid check_path value: 'foo'

When using an existing file in the filesystem, saving the log fails as appearently the argument is implicitely expected to be a folder?

mkdir foo
algobattle git/algobattle-problems/algobattle_problems/pairsum --result foo
╔═══════════╦════════╦════════╗
║ Generator ║ Solver ║ Result ║
╠═══════════╬════════╬════════╣
║   team_0  ║ team_0 ║  50000 ║
╚═══════════╩════════╩════════╝
Team team_0 gained 100.0 points.
Traceback (most recent call last):
  File "/home/henri/.local/bin/algobattle", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/henri/.local/lib/python3.11/site-packages/algobattle/cli.py", line 113, in main
    with open(exec_config.result / filename, "w+") as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
NotADirectoryError: [Errno 20] Not a directory: 'foo/2023-05-25_15-39-59.json'

Images are not cleaned properly when parser/verifier crashes

Sometimes the parser/verifier contains a bug that let's a team crash the script. If this is the case the images of the different teams are not properly cleaned. This could enable a malicious team to steal the containers of other teams in the next battle.

Create results folder when using `algobattle run` if not already existing

When writing a new problem, oftentimes one creates the necessary problem.py, algobattle.toml as well as a dummy solver and generator, that one would like to test. However, the algobattle run cli command expects there to already be a results folder in the same directory if no explicit destination for results is set.

It would be nice if the tool creates the folder on the first run if it is not already present. Currently, it throws an error otherwise.

Optionally output instance/solution pair into results for debugging

Students asked us to add an option to the cli interface that instances and solutions that are generated are written into the results, or out in some other fashion. This makes it easier, especially when using randomization, to see which concrete instances result in a long runtime or even produce errors when developing code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.