[{"data":1,"prerenderedAt":863},["ShallowReactive",2],{"dev-\u002Fdeveloper\u002Fgetting-started":3},{"id":4,"title":5,"body":6,"description":856,"extension":857,"meta":858,"navigation":156,"path":859,"seo":860,"stem":861,"__hash__":862},"content\u002Fdeveloper\u002Fgetting-started.md","Getting started — solve your first model",{"type":7,"value":8,"toc":847},"minimark",[9,14,36,49,54,57,82,93,97,108,686,690,693,748,752,768,772,775,780,784,817,821,828,843],[10,11,13],"h1",{"id":12},"solve-your-first-model","Solve your first model",[15,16,17,18,22,23,26,27,30,31,35],"p",{},"Quicopt is a solver for hard optimization problems. The point of this page is to\nget you from an empty directory to a solved model in ",[19,20,21],"strong",{},"three steps",": install,\nrun an example, understand what happened. You build the model in a standard\nPython modeling front-end — ",[19,24,25],{},"OR-Tools MathOpt"," or ",[19,28,29],{},"Pyomo",", nothing\nQuicopt-specific to learn — and hand it to a single ",[32,33,34],"code",{},"client.solve()"," call.",[15,37,38,39,42,43,48],{},"Everything here runs on the ",[19,40,41],{},"free tier",": no account, no API key to manage —\nyour first call sets one up automatically. It is a small entry point to try the\nAPI; if you have questions or want to go further,\n",[44,45,47],"a",{"href":46},"#beyond-the-free-tier","talk to us",".",[50,51,53],"h2",{"id":52},"step-1-install","Step 1 — Install",[15,55,56],{},"The client is one package on PyPI. Install it with the front-end you model in —\nthe examples on this page use OR-Tools MathOpt:",[58,59,64],"pre",{"className":60,"code":61,"language":62,"meta":63,"style":63},"language-bash shiki shiki-themes github-dark","pip install \"quicopt[mathopt]\"\n","bash","",[32,65,66],{"__ignoreMap":63},[67,68,71,75,79],"span",{"class":69,"line":70},"line",1,[67,72,74],{"class":73},"svObZ","pip",[67,76,78],{"class":77},"sU2Wk"," install",[67,80,81],{"class":77}," \"quicopt[mathopt]\"\n",[15,83,84,85,88,89,92],{},"If you prefer Pyomo, install ",[32,86,87],{},"quicopt[pyomo]"," instead — ",[32,90,91],{},"solve()"," accepts both\nkinds of model directly. That's the whole setup: no license file, no signup, no\nkey to copy anywhere.",[50,94,96],{"id":95},"step-2-run-an-example","Step 2 — Run an example",[15,98,99,100,103,104,107],{},"Two ready-to-run scripts — a ",[19,101,102],{},"QUBO"," and a small ",[19,105,106],{},"MILP",". Save either one and\nrun it. Switch tabs to compare — each slide shows the model and exactly what\nprints:",[109,110,111,463],"try-examples",{},[112,113,115,458],"try-example",{"file":114,"label":102},"qubo.py",[58,116,120],{"className":117,"code":118,"filename":114,"language":119,"meta":63,"style":63},"language-python shiki shiki-themes github-dark","from ortools.math_opt.python import mathopt\nfrom quicopt import Client\n\n# A QUBO: 4 binary variables, a quadratic objective, no constraints.\nmodel = mathopt.Model(name=\"qubo\")\nx = [model.add_binary_variable(name=f\"x{i}\") for i in range(4)]\n\n# Reward each variable; penalise adjacent pairs on the 4-cycle 0-1-2-3-0.\n# Distinct linear weights break the symmetry, so the optimum is unique.\nmodel.minimize(\n    -(1.0 * x[0] + 0.7 * x[1] + 1.3 * x[2] + 0.5 * x[3])\n    + 2.0 * (x[0] * x[1] + x[1] * x[2] + x[2] * x[3] + x[0] * x[3])\n)\n\nclient = Client(\"https:\u002F\u002Ftry.quicoptapi.pgi.fz-juelich.de\")\nresult = client.solve(model)\nprint(result.display)\n","python",[32,121,122,138,151,158,165,189,247,252,258,264,270,337,412,417,422,438,449],{"__ignoreMap":63},[67,123,124,128,132,135],{"class":69,"line":70},[67,125,127],{"class":126},"snl16","from",[67,129,131],{"class":130},"s95oV"," ortools.math_opt.python ",[67,133,134],{"class":126},"import",[67,136,137],{"class":130}," mathopt\n",[67,139,141,143,146,148],{"class":69,"line":140},2,[67,142,127],{"class":126},[67,144,145],{"class":130}," quicopt ",[67,147,134],{"class":126},[67,149,150],{"class":130}," Client\n",[67,152,154],{"class":69,"line":153},3,[67,155,157],{"emptyLinePlaceholder":156},true,"\n",[67,159,161],{"class":69,"line":160},4,[67,162,164],{"class":163},"sAwPA","# A QUBO: 4 binary variables, a quadratic objective, no constraints.\n",[67,166,168,171,174,177,181,183,186],{"class":69,"line":167},5,[67,169,170],{"class":130},"model ",[67,172,173],{"class":126},"=",[67,175,176],{"class":130}," mathopt.Model(",[67,178,180],{"class":179},"s9osk","name",[67,182,173],{"class":126},[67,184,185],{"class":77},"\"qubo\"",[67,187,188],{"class":130},")\n",[67,190,192,195,197,200,202,204,207,210,214,217,220,223,226,229,232,235,238,241,244],{"class":69,"line":191},6,[67,193,194],{"class":130},"x ",[67,196,173],{"class":126},[67,198,199],{"class":130}," [model.add_binary_variable(",[67,201,180],{"class":179},[67,203,173],{"class":126},[67,205,206],{"class":126},"f",[67,208,209],{"class":77},"\"x",[67,211,213],{"class":212},"sDLfK","{",[67,215,216],{"class":130},"i",[67,218,219],{"class":212},"}",[67,221,222],{"class":77},"\"",[67,224,225],{"class":130},") ",[67,227,228],{"class":126},"for",[67,230,231],{"class":130}," i ",[67,233,234],{"class":126},"in",[67,236,237],{"class":212}," range",[67,239,240],{"class":130},"(",[67,242,243],{"class":212},"4",[67,245,246],{"class":130},")]\n",[67,248,250],{"class":69,"line":249},7,[67,251,157],{"emptyLinePlaceholder":156},[67,253,255],{"class":69,"line":254},8,[67,256,257],{"class":163},"# Reward each variable; penalise adjacent pairs on the 4-cycle 0-1-2-3-0.\n",[67,259,261],{"class":69,"line":260},9,[67,262,263],{"class":163},"# Distinct linear weights break the symmetry, so the optimum is unique.\n",[67,265,267],{"class":69,"line":266},10,[67,268,269],{"class":130},"model.minimize(\n",[67,271,273,276,278,281,284,287,290,293,296,299,301,303,306,308,310,313,315,317,320,322,324,327,329,331,334],{"class":69,"line":272},11,[67,274,275],{"class":126},"    -",[67,277,240],{"class":130},[67,279,280],{"class":212},"1.0",[67,282,283],{"class":126}," *",[67,285,286],{"class":130}," x[",[67,288,289],{"class":212},"0",[67,291,292],{"class":130},"] ",[67,294,295],{"class":126},"+",[67,297,298],{"class":212}," 0.7",[67,300,283],{"class":126},[67,302,286],{"class":130},[67,304,305],{"class":212},"1",[67,307,292],{"class":130},[67,309,295],{"class":126},[67,311,312],{"class":212}," 1.3",[67,314,283],{"class":126},[67,316,286],{"class":130},[67,318,319],{"class":212},"2",[67,321,292],{"class":130},[67,323,295],{"class":126},[67,325,326],{"class":212}," 0.5",[67,328,283],{"class":126},[67,330,286],{"class":130},[67,332,333],{"class":212},"3",[67,335,336],{"class":130},"])\n",[67,338,340,343,346,348,351,353,355,358,360,362,364,366,368,370,372,374,376,378,380,382,384,386,388,390,392,394,396,398,400,402,404,406,408,410],{"class":69,"line":339},12,[67,341,342],{"class":126},"    +",[67,344,345],{"class":212}," 2.0",[67,347,283],{"class":126},[67,349,350],{"class":130}," (x[",[67,352,289],{"class":212},[67,354,292],{"class":130},[67,356,357],{"class":126},"*",[67,359,286],{"class":130},[67,361,305],{"class":212},[67,363,292],{"class":130},[67,365,295],{"class":126},[67,367,286],{"class":130},[67,369,305],{"class":212},[67,371,292],{"class":130},[67,373,357],{"class":126},[67,375,286],{"class":130},[67,377,319],{"class":212},[67,379,292],{"class":130},[67,381,295],{"class":126},[67,383,286],{"class":130},[67,385,319],{"class":212},[67,387,292],{"class":130},[67,389,357],{"class":126},[67,391,286],{"class":130},[67,393,333],{"class":212},[67,395,292],{"class":130},[67,397,295],{"class":126},[67,399,286],{"class":130},[67,401,289],{"class":212},[67,403,292],{"class":130},[67,405,357],{"class":126},[67,407,286],{"class":130},[67,409,333],{"class":212},[67,411,336],{"class":130},[67,413,415],{"class":69,"line":414},13,[67,416,188],{"class":130},[67,418,420],{"class":69,"line":419},14,[67,421,157],{"emptyLinePlaceholder":156},[67,423,425,428,430,433,436],{"class":69,"line":424},15,[67,426,427],{"class":130},"client ",[67,429,173],{"class":126},[67,431,432],{"class":130}," Client(",[67,434,435],{"class":77},"\"https:\u002F\u002Ftry.quicoptapi.pgi.fz-juelich.de\"",[67,437,188],{"class":130},[67,439,441,444,446],{"class":69,"line":440},16,[67,442,443],{"class":130},"result ",[67,445,173],{"class":126},[67,447,448],{"class":130}," client.solve(model)\n",[67,450,452,455],{"class":69,"line":451},17,[67,453,454],{"class":212},"print",[67,456,457],{"class":130},"(result.display)\n",[459,460],"term-result",{":rows":461,"cmd":462},"[\"├── shots\",\"│   ├── 1 · Heuristic 1   -2.3   0.0s  ◀ best\",\"│   ├── 2 · Heuristic 2   -2.3   0.0s\",\"│   └── 3 · Heuristic 2   -2.3   0.0s\",\"├── status:     heuristic\",\"├── feasible:   n\u002Fa\",\"├── objective:  -2.3\",\"├── x:          x0=1, x1=0, x2=1, x3=0  (4 variables)\",\"└── solve_time: 0.0017 s\"]","$ python qubo.py",[112,464,466,682],{"file":465,"label":106},"milp.py",[58,467,469],{"className":117,"code":468,"filename":465,"language":119,"meta":63,"style":63},"from ortools.math_opt.python import mathopt\nfrom quicopt import Client\n\n# A tiny mixed-integer model: one continuous and one integer variable.\nmodel = mathopt.Model(name=\"milp\")\nx = model.add_variable(lb=0.0, name=\"x\")\ny = model.add_integer_variable(lb=0.0, ub=10.0, name=\"y\")\nmodel.add_linear_constraint(x + 2 * y \u003C= 14)\nmodel.add_linear_constraint(3 * x - y >= 0)\nmodel.maximize(3 * x + 4 * y)\n\nclient = Client(\"https:\u002F\u002Ftry.quicoptapi.pgi.fz-juelich.de\")\nresult = client.solve(model)\nprint(result.display)\n",[32,470,471,481,491,495,500,517,546,583,606,631,652,656,668,676],{"__ignoreMap":63},[67,472,473,475,477,479],{"class":69,"line":70},[67,474,127],{"class":126},[67,476,131],{"class":130},[67,478,134],{"class":126},[67,480,137],{"class":130},[67,482,483,485,487,489],{"class":69,"line":140},[67,484,127],{"class":126},[67,486,145],{"class":130},[67,488,134],{"class":126},[67,490,150],{"class":130},[67,492,493],{"class":69,"line":153},[67,494,157],{"emptyLinePlaceholder":156},[67,496,497],{"class":69,"line":160},[67,498,499],{"class":163},"# A tiny mixed-integer model: one continuous and one integer variable.\n",[67,501,502,504,506,508,510,512,515],{"class":69,"line":167},[67,503,170],{"class":130},[67,505,173],{"class":126},[67,507,176],{"class":130},[67,509,180],{"class":179},[67,511,173],{"class":126},[67,513,514],{"class":77},"\"milp\"",[67,516,188],{"class":130},[67,518,519,521,523,526,529,531,534,537,539,541,544],{"class":69,"line":191},[67,520,194],{"class":130},[67,522,173],{"class":126},[67,524,525],{"class":130}," model.add_variable(",[67,527,528],{"class":179},"lb",[67,530,173],{"class":126},[67,532,533],{"class":212},"0.0",[67,535,536],{"class":130},", ",[67,538,180],{"class":179},[67,540,173],{"class":126},[67,542,543],{"class":77},"\"x\"",[67,545,188],{"class":130},[67,547,548,551,553,556,558,560,562,564,567,569,572,574,576,578,581],{"class":69,"line":249},[67,549,550],{"class":130},"y ",[67,552,173],{"class":126},[67,554,555],{"class":130}," model.add_integer_variable(",[67,557,528],{"class":179},[67,559,173],{"class":126},[67,561,533],{"class":212},[67,563,536],{"class":130},[67,565,566],{"class":179},"ub",[67,568,173],{"class":126},[67,570,571],{"class":212},"10.0",[67,573,536],{"class":130},[67,575,180],{"class":179},[67,577,173],{"class":126},[67,579,580],{"class":77},"\"y\"",[67,582,188],{"class":130},[67,584,585,588,590,593,595,598,601,604],{"class":69,"line":254},[67,586,587],{"class":130},"model.add_linear_constraint(x ",[67,589,295],{"class":126},[67,591,592],{"class":212}," 2",[67,594,283],{"class":126},[67,596,597],{"class":130}," y ",[67,599,600],{"class":126},"\u003C=",[67,602,603],{"class":212}," 14",[67,605,188],{"class":130},[67,607,608,611,613,615,618,621,623,626,629],{"class":69,"line":260},[67,609,610],{"class":130},"model.add_linear_constraint(",[67,612,333],{"class":212},[67,614,283],{"class":126},[67,616,617],{"class":130}," x ",[67,619,620],{"class":126},"-",[67,622,597],{"class":130},[67,624,625],{"class":126},">=",[67,627,628],{"class":212}," 0",[67,630,188],{"class":130},[67,632,633,636,638,640,642,644,647,649],{"class":69,"line":266},[67,634,635],{"class":130},"model.maximize(",[67,637,333],{"class":212},[67,639,283],{"class":126},[67,641,617],{"class":130},[67,643,295],{"class":126},[67,645,646],{"class":212}," 4",[67,648,283],{"class":126},[67,650,651],{"class":130}," y)\n",[67,653,654],{"class":69,"line":272},[67,655,157],{"emptyLinePlaceholder":156},[67,657,658,660,662,664,666],{"class":69,"line":339},[67,659,427],{"class":130},[67,661,173],{"class":126},[67,663,432],{"class":130},[67,665,435],{"class":77},[67,667,188],{"class":130},[67,669,670,672,674],{"class":69,"line":414},[67,671,443],{"class":130},[67,673,173],{"class":126},[67,675,448],{"class":130},[67,677,678,680],{"class":69,"line":419},[67,679,454],{"class":212},[67,681,457],{"class":130},[459,683],{":rows":684,"cmd":685},"[\"├── status:     optimal\",\"├── feasible:   true\",\"├── objective:  42.0\",\"├── x:          x=14, y=0  (2 variables)\",\"└── solve_time: 0.0041 s\"]","$ python milp.py",[50,687,689],{"id":688},"step-3-understand-what-happened","Step 3 — Understand what happened",[15,691,692],{},"The example did three things:",[694,695,696,707,719],"ol",{},[697,698,699,702,703,706],"li",{},[19,700,701],{},"Built a model"," — a standard MathOpt ",[32,704,705],{},"Model"," with variables, an objective,\nand (in the MILP) constraints. Nothing in it is Quicopt-specific; the same\ncode runs against any MathOpt-compatible solver, and a Pyomo model works the\nsame way.",[697,708,709,715,716,48],{},[19,710,711,712],{},"Called ",[32,713,714],{},"client.solve(model)"," — the client converted the model, sent it to\nthe Quicopt API, and took care of the API key: your very first call needs no\nkey, one is set up automatically and reused for every later call on the same\n",[32,717,718],{},"Client",[697,720,721,724,725,728,729,732,733,536,736,739,740,743,744,48],{},[19,722,723],{},"Printed and returned the result"," — ",[32,726,727],{},"result.display"," is the framed view the\nserver renders; the ",[32,730,731],{},"Result"," object also carries ",[32,734,735],{},"status",[32,737,738],{},"objective",", and\nthe ",[32,741,742],{},"solution"," keyed by your variable names. Every field is described in the\n",[44,745,747],{"href":746},"\u002Fdeveloper\u002Fapi","API reference",[50,749,751],{"id":750},"what-you-can-solve-today","What you can solve today",[15,753,754,755,758,759,763,764,767],{},"The API currently solves ",[19,756,757],{},"LP, QP, MILP, MINLP, QUBO, PUBO\u002FHUBO, and NLP","\nmodels — there is a ",[44,760,762],{"href":761},"\u002Fdeveloper\u002Fexamples","runnable example for each",". One\nfree-tier edge to know: in a non-linear model, integer variables beyond binary\non\u002Foff decisions aren't accepted yet. ",[19,765,766],{},"Black-box objectives are coming soon",";\na model outside today's classes is declined with a readable message, never a\nhalf-solved result.",[50,769,771],{"id":770},"beyond-the-free-tier","Beyond the free tier",[15,773,774],{},"The free tier is a small, one-time entry point to try the API. Questions,\nsomething unclear, or real models you want to try Quicopt on? Just ask:",[776,777],"contact-cta",{"sub":778,"title":779},"Whether something's unclear or you want to try Quicopt on your real models — tell us what you're optimizing.","Questions? Talk to us.",[50,781,783],{"id":782},"where-next","Where next",[785,786,787,793,810],"ul",{},[697,788,789,792],{},[44,790,791],{"href":761},"Examples"," — a runnable model for every supported problem\nclass, including how an infeasible model comes back.",[697,794,795,797,798,801,802,536,804,806,807,809],{},[44,796,747],{"href":746}," — the ",[32,799,800],{},"quicopt"," Python client in full:\n",[32,803,718],{},[32,805,91],{},", the ",[32,808,731],{}," fields, and the async job API.",[697,811,812,816],{},[44,813,815],{"href":814},"\u002Fdeveloper\u002Fdata-format","Modeling front-ends"," — what you can express in\nPyomo and OR-Tools MathOpt.",[50,818,820],{"id":819},"about-this-service","About this service",[15,822,823,824,827],{},"The free evaluation API is provided ",[19,825,826],{},"as-is",", for evaluation and research only —\nwithout availability, functionality or result guarantees, and without any\nservice level. Liability is limited, to the extent permitted by law, to intent\nand gross negligence.",[15,829,830,833,834,838,839,48],{},[19,831,832],{},"We keep the data you send over the API"," to improve future versions of our\nsolvers. Please don't submit personal, confidential or otherwise sensitive data\ninside an optimization model — the service isn't designed for that. Full\ndetails: ",[44,835,837],{"href":836},"\u002F?legal=datenschutz","Privacy Policy"," · ",[44,840,842],{"href":841},"\u002F?legal=impressum","Legal notice",[844,845,846],"style",{},"html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html pre.shiki code .s9osk, html code.shiki .s9osk{--shiki-default:#FFAB70}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}",{"title":63,"searchDepth":140,"depth":140,"links":848},[849,850,851,852,853,854,855],{"id":52,"depth":140,"text":53},{"id":95,"depth":140,"text":96},{"id":688,"depth":140,"text":689},{"id":750,"depth":140,"text":751},{"id":770,"depth":140,"text":771},{"id":782,"depth":140,"text":783},{"id":819,"depth":140,"text":820},"pip install quicopt, build a model in Pyomo or OR-Tools MathOpt, and solve it with the Quicopt API — in three steps.","md",{},"\u002Fdeveloper\u002Fgetting-started",{"title":5,"description":856},"developer\u002Fgetting-started","FvMS6s5imogAlihjcLzNxOYz8DL8qsjbDlInbzc6HWI",1783518720545]