RAPOSa

Reformulation Algorithm for Polynomial Optimization - Santiago

Requirements

You can use RAPOSa on the following operating systems:

User options

The available options are: (1)

(1) Available options depend on the operating system. This list is for Ubuntu 22.

Not all options are compulsory. The correct way to pass the options is with "-" followed by the corresponding option and the corresponding value, as shown below:


			raposa problem.nl -nonlinsolver knitro -output file.out -outlev 1 -repfreq 5 -maxtime 60
		

Another way to pass the options is through a file called "raposa.options" as shown below:


			nonlinsolver knitro
			output file.out
			outlev 1
			repfreq 5
			maxtime 60
		

This file must be in the directory you are executing RAPOSa.

Example of use

You can download the files used in this section here.

Consider the following polynomial programming problem with box-constrained variables: $$ \begin{array}{rl} \text{min} & x^2 + y^2 + x\\ \text{s.t}. & xy\geq 1\\ & 1\leq x \leq 10\\ & 0\leq y \leq 8\\ \end{array} $$

We are going to explain how to solve it using AMPL, Pyomo, JuMP or GAMS. The user must have raposa executable in the system path

How to formulate the problem in AMPL and solve it using RAPOSa.

In AMPL, the problem would be written as follows:


			var x >=1, <= 10;
			var y >=0, <= 8;
			minimize f: x^2 + y^2 + x;
			subject to g: x*y >= 1;
		

If you want to solve this with RAPOSa, you have to add the following commands:


			option solver raposa;
			solve;
		

If you want to run RAPOSa with specific options, you have to add the following line before the "solve" command*:


			option raposa_options 'outlev=1 maxtime=60';
		

For more information about interacting with AMPL, you can see this link.

*You can also pass options to RAPOSa using "raposa.options" files as we explained before

How to formulate the problem in Pyomo and solve it using RAPOSa.

In Pyomo, the problem would be written as follows:


			from pyomo.environ import *
			m = ConcreteModel()
			m.x = Var(bounds=(1,10))
			m.y = Var(bounds=(0,8))
			def obj(m):
				return (m.x*m.x + m.y*m.y + m.x)
			def cons(m):
				return (m.x * m.y >= 1)
			m.obj = Objective(rule=obj)
			m.cons = Constraint(rule=cons)
		

If you want to solve this with RAPOSa, you have to add the following commands:


			opt = SolverFactory('raposa')
			opt.solve(m, tee=True)
		

If you want to run RAPOSa with specific options, you have to add the following lines before the "opt.solve" command*:


			opt.options["outlev"] = 1
			opt.options["maxtime"] = 60
		

For more information about interacting with Pyomo, you can see this link.

*You can also pass options to RAPOSa using "raposa.options" files as we explained before

How to formulate the problem in JuMP and solve it using RAPOSa.

In JuMP, the problem would be written as follows:


			using JuMP, AmplNLWriter
			m = Model()
			@variable(m, 1 <= x <= 10 )
			@variable(m, 0 <= y <= 8 )
			@NLobjective(m, Min, x^2 + y^2 + x )
			@NLconstraint(m, x*y >= 1.0 )
		

If you want to solve this with RAPOSa, you have to indicate it in the second line of the previous code:


			using JuMP, AmplNLWriter
			m = Model(() -> AmplNLWriter.Optimizer("raposa"))
			@variable(m, 1 <= x <= 10 )
			@variable(m, 0 <= y <= 8 )
			@NLobjective(m, Min, x^2 + y^2 + x )
			@NLconstraint(m, x*y >= 1.0 )
			optimize!(m)			
		

If you want to run RAPOSa with specific options, you have to indicate it in the second line of the previous code as follows*:


			m = Model(() -> AmplNLWriter.Optimizer("./raposa",["-outlev=1","-maxtime=60"]))
		

For more information about interacting with JuMP, you can see this link.

*You can also pass options to RAPOSa using "raposa.options" files as we explained before

How to formulate the problem in GAMS and solve it using RAPOSa.

Unfortunately there is no way to directly solve a model written in GAMS using RAPOSa. However, you can convert the model to AMPL, Pyomo or JuMP by following the instructions in this link. After that, you can solve the problem with RAPOSa following the steps of the previous sections.

How to solve a problem in .nl format with RAPOSa

RAPOSa is also compatible with standard .nl files. Solve a problem in .nl format with RAPOSa is easy. You only need to run the following command:


			./raposa problem.nl
		

and RAPOSa will be executed with default options.

If you want to run it with specific options, for example a time limit of 30 seconds and gurobi as linear solver, you should run the following command:


			./raposa problem.nl -maxtime 30 -linsolver gurobi
		

If you want to know all available options, you should run the following command:


			./raposa -help
		

In this case, if you run the command


			./raposa problem.nl -outlev 1 -output output.json
		

you will obtain the following output:


			 _____             _____    ____    _____        
			|  __ \     /\    |  __ \  / __ \  / ____|       
			| |__) |   /  \   | |__) || |  | || (___    __ _ 
			|  _  /   / /\ \  |  ___/ | |  | | \___ \  / _` |
			| | \ \  / ____ \ | |     | |__| | ____) || (_| |
			|_|  \_\/_/    \_\|_|      \____/ |_____/  \__,_|
			
			===========================================================================================
			 RAPOSa v4.2.0 (2023.03.11)
			 Copyright (C) 2023 CITMAga - Univ. de Santiago de Compostela (USC). All rights reserved.
			 This software is free for non-commercial purposes.
			 Full licence information can be found in the LICENSE.txt file.
			 Website: https://raposa.usc.es
			 To cite RAPOSa use: https://doi.org/10.1007/s10898-022-01229-w
		    ===========================================================================================
			 Linear solver: gurobi
			 Nonlinear solver: ipopt
		    =====================================================================================================================
			  Iteration       Time (s)       Lower Bound       Upper Bound       Relative Gap     Absolute Gap       Feas error
					  1           0.03            3.0000            3.0000         0.00000000           0.0000       0.00000000
		   
		    Global solution found after 1 iterations and 0.0268603 seconds. 
		    Objective: 3
		

and the following "output.json" file:


			{
				"Total time": 0.0132397, 
				"Number of iterations": 1, 
				"Upper bound": 3, 
				"Lower bound": 3, 
				"Absolute gap": 1.14956e-08, 
				"Relative gap": 3.8306e-09, 
				"Feasilibity error": 0, 
				"Solution": {
					"x[0]" : 1, 
					"x[1]" : 1
				}
			}