Giter Site home page Giter Site logo

optidef's People

Contributors

jeslago avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

optidef's Issues

Include inf / sup, infimum / supremum

Dear Jeslago,

Is it possible to include the options inf / sup, infimum / supremum? I am currently working on an optimization problem where an infimum is required. Thank you very much in advance and kind Regards. :)

Jan

Set of variables

Hi,

First congrats for the package! Is really intutitive and easy to use.

I am trying to write an optimization model (as expected). But I have a really large set of different variables (not x1,x2... but p^{es}_{t},q^{es}_t instead). Since is completely impossible to have them under the min symbol I have created a set of variables (Gamma) instead.

After the constraints I want to write

where Gamma={................}

But I dont know how i can align the "where" with "minimize" and "subject to"

Thanks in advance!!

upper and lower bound variable constraints

Hi

I am really enjoying your package, but I would like to see a feature (or maybe it is already implemented, though I could not find any documentation on it) for having constraints defined with upper and lower bounds that aligns (aesthetically) well with typical constraints. Here is an example.

\begin{mini}
{v}{c^Tv}{}{}
{\label{OP:FBA}}
\addConstraint{Sv}{=0}{}
\addConstraint{L \leq}{v \leq U}{}
\end{mini}

I think it would be advantageous if the "v" in the second constraint would align with the "=' for the first constraint. Such constraints are abundant in optimization problems using in cell metabolism modelling.

Long Constraints with tags

Hello sorry to bother but I have a situation with optidef, here is an example of my code :
\begin{mini!}[3]
{}{\theta}{}{\text{(TSP-SD)}\quad}\tag{1}\protect\label{eq_obj2}
\addConstraint{l_i }{\geq \hat{a}{i,r}^d - (1-\sum{\substack{j \in C,\i\neq j}} y_{i,j,i}^{d,r})M_1}{\forall i \in C\cup {0}, \forall d \in D, \forall r \in R}\tag{18}\protect\label{eq_ct36}
\addConstraint{\hat{l}{i,r}^d}{\geq a_i + (\Bar{t} - t{j,i}) - (1-\sum_{\substack{j \in C,\i\neq j}} y_{i,j,i}^d)M_2}{si ; t_{j,i} < \Bar{t}, \forall i \in C\cup {0, n+1}, \forall d \in D, \forall r \in R }\tag{19}\protect\label{eq_ct37}
\end{mini!}

The issue is that the constraint are so long that the tags appear bellow the model and not next to it. Can you help me?

Counter too large

Hi,
I have more than 26 constraints in my model and I have used {mini!} environment. If I add the 27th constraint in, latex will not compile and have the error ‘Counter too large'. I find that the labeling of constraints cannot go more than z. For instacne, the labeling can go from 3a-3z but not more. How to deal with this? The follwoing is my code. (it will not compile)

%\begin{mini!}
% {X_{ij}^t,P_{ij}^t, I_{nk}^t }{\overline{Z} \protect\label{eq:ObjectiveExample1}}
% {\label{MILP}}{}
% \addConstraint{ \overline{Z} \geq X_{ij}^tt,\forall l {ij} \in L_R, \forall t\in T \protect \label{c18} }
% \addConstraint{B^t_i=\beta E_i^t-\sum
{l_{ij}\in L_T} P_{ij}^tX_{ij}^t, \forall i \in V_R, t=1 \protect\label{c1}}
% \addConstraint{B^{t+1}i = B_i^t +\beta E_i^{t+1} - \sum{l_{ij}\in L_T} P^{t+1}{ij}X^{t+1}{ij},} { \forall i \in V_R, t=1,2,3,\dots,T-1 \protect \label{c2}}
% \addConstraint{B_n^t= Y_n^t - P_{ni}^t X_{ni}^t, \forall n \in V_E, t =1 \protect\label{c4} }
% \addConstraint{B_n^{t+1} = B_n^t +Y_n^{t+1}-P_{ni}^{t+1}X_{ni}^{t+1} , \forall n \in V_E, \forall l_{ni} \in L_N, t= 1,2,3,\dots T-1 \protect\label {c5}}
% \addConstraint{ P_{ij}^tX_{ij}^t +P_{i\hat{e}}^t X_{i\hat{e}}^t \leq B_{max}, \forall i \in V_R, \forall l_{ij} \in L_T, \forall t\in T\label{c3}}
% \addConstraint{ P_{ni}^tX_{ni}^t \leq \hat{B}{max} , \forall n \in V_E, \forall t \in T\protect \label{c15} }
% \addConstraint{ \sum\limits
{t=1}^T X_{xy}^t \geq 1, \forall l_{xy} \in L_R \protect\label{c6}}
% \addConstraint{ \sum\limits_{l_{yu}\in L_T}X_{yu}^t, \forall y \in V_R,\forall t\in T\protect\label{c7} }
% \addConstraint{\gamma( Q^t_{xy}+N_0) \geq \Phi_1(X_{xy}^t-1),\protect\label{c8}}
% \addConstraint{ Q^t_{xy}=\sum_{l_{ij}\in L\setminus l_{xy}}G_{iy}P_{ij}^{t}X_{ij}^t, \forall l_{xy}\in L_R, \forall t\in T\protect \label{c8s} }
% \addConstraint{0\leq P_{ij}^t, t= 1,2,\dots T, \forall l_{ij} \in L_T\protect \label{c9}}
% \addConstraint{0\leq P_{ni}^t , \forall t\in T, \forall l_{ni} \in L_N\protect \label{c10} }
% \addConstraint{0\leq B_i^t\leq B_{max} , \forall i \in V_R, \forall t\in T\protect \label{c11}}
% \addConstraint{0 \leq B_n^t \leq \hat{B}{max} , \forall n \in V_E,\forall t\in T \protect \label{c12} }
% \addConstraint{S_i^t \geq 0, \forall n \in V_R, \forall t \in T \protect \label{c11s}}
% \addConstraint{S_n^t \geq 0, \forall n \in V_E, \forall t \in T\protect \label{c12s}}
% \addConstraint{ Y_n^t \geq 0, \forall n \in V_E, t= 1,2, 3\dots T\protect \label{c13}}
% \addConstraint{ Y_n^t \leq M
{nk}^t,\forall n \in V_E,\forall t\in T \protect \label{c14}}
% \displaybreak
% \addConstraint{ (1) \geq Y_n^t, \forall n \in V_E, \forall l_{ni}\in L_N, \forall t\in T\protect \label{c16 }}
% \addConstraint{Y_n\geq ,\forall n \in V_E,\forall t\in T\protect \label{c17}}
% \addConstraint{ k= 1, \forall n \in V_E, \forall t \in T\protect \label{c24}}
% \addConstraint{ I \leq M_{nt}^k\leq I_{nt}^k P_U^k, \forall t\in T,k = {1,2,3,\dots, K}, \forall n \in V_E \protect \label{c19} }
% \addConstraint{ k\leq I_{nt}^k \Phi_4, \forall t\in T, k = {1,2,3,\dots, K}, \forall n \in V_E\protect \label{c20}}
% \addConstraint{ k \geq 0 , \forall t\in T, k = {1,2,3,\dots, K}, \forall n \in V_E\protect\label{c21}}
% \addConstraint{abc}
%\end{mini!}

Personalized environments

To whomever could be interested.

I find optidef library extremely useful, nevertheless, I think a little more flexibility could help a lot the users.
I have recently come to this conclusion since I have the need to describe an optimization problem which is lexicographic too.
As an example, rather than write
min f(x)
s.t. g(x) <= 0
I need
lex min f_1(x), f_2(x), f_3(x)
s.t. g(x) <= 0
where "lex" stands for "lexicographic".

Even though the use of multiple function is already supported by the library, the same is not true for the lexicographic optimization.
Indeed, as far as I know, the only types of optimization supported by optidef are "min", "max", "argmin", "argmax".
From here the question: could be useful to give the user the possibility to declare personalized/customized environments? Of course, for me the answer is yes.
For instance, a possible name for the environment I need could be "minl" or "lmin", which would be used as
\begin{lmin}|s|
{}{f_1(x), f_2(x), f_3(x)}{}{}
\addConstraint{g(x)}{\le 0}{}
\end{lmin}
while the long format could print out either "lexicographic minimize" or "lex minimize".

Is there anyone who agree with my consideration on the usefulness of personalized environment?

(congrats for the quality of the library)

Naming and referencing a mathematical program

As is usual in literature, mathematical programs usually bear a name or a tag, e.g. P, placed at their left or right. How can I give and reference the whole program (with \eqref{}) by such a name and not just the objective function?
(Without losing the tags of each constraint and the objective)

example

Optimization variables in \scriptstyle

Thanks for this package. It really helps to nicely typeset optimization problems. However, I think the variables over which the objective function is optimized should by default be typeset with \scriptstyle instead of normal size, just as with the standard \max_{}, \min_{}, etc. functions.

maxi environment changed the alignment

Hi, when I use TeX Live 2023, the example of the manual gives a slightly different output.

\documentclass{article}
\usepackage{optidef}

\begin{document}

\begin{maxi}
	{w}{f(w)+ R(w+6x)}
	{g(w)}{=0}
	{\label{eq:Example1}}{}
	\addConstraint{g(w)}{=0}
	\addConstraint{n(w)}{= 6}
	\addConstraint{L(w)+r(x)}{=Kw+p}
	\addConstraint{h(x)}{=0.}
\end{maxi}

\end{document}

image

Missing extra alignment for first constraint with constraint format 3

Hi,

I've noticed a small bug with the extra alignment for the first constraint if constraint format 3 is used.
When I switch from constraint format 2 to 3 the content of the extra alignment brackets does vanish, but only for the first constraint added to the program. I've attached two screenshots to illustrate the problem. Maybe you've got any idea, what might be the problem there?
I'm using optidef 2016/10/22 - version=2.3
Thanks for your help!

capture2
capture

Hint regarding \protect

AFAIK, it is also possible to use

\usepackage{etoolbox}
\robustify{\label}

and then skip the individual \protect commands

Maybe that can be added to the documentation or the package itself?

translate minimize/subject to

I would like to translate to portuguese:
"minimize" -> "minimizar"
"subject to"-> "sujeito a"
Is it possible to redefine easily?

Thanks

Wrong font for “min” and “s.t” in beamer class

First of all I'd like to thank you for the awesome package. It's a real bless not struggling with the aligning of optimization problems by hand anymore.

Unfortunately there seems to be a problem when using optidef with the beamer class. The following MWE shows that the keywords "min" and "s.t." aren't typeset in the standard beamer font.

\documentclass{beamer}
\usepackage[short]{optidef}

\begin{document}
\begin{frame}[t]\frametitle{MWE}

\begin{mini*}
	{x,y}{\sum_{i=1}^{n}\sum_{j=1}^{m} a_{j}x_{ij}}{}{}
	\addConstraint{\sum_{j=1}^{m} x_{ij}}{\leq d_i,}{\forall i=1,\ldots,n}
	\addConstraint{x_{ij}}{\in \{0,1\}}{}
\end{mini*}

VS

\[
	\min_{x,y}
\]
\end{frame}
\end{document}

mwe.pdf

Incorrect horizontal alignment with long constraint

I'd like to thank you for this very helpful package!

I have an issue with the horizontal alignment of a problem with a long constraint. Instead of the problem being moved/aligned to the left (in order to fit in the whole page), it overflows to the right. This only happens with the (referenced) mini environment, the horizontal alignment works perfectly with the mini* environment.

You will find a MWE below:

\documentclass{article}
\usepackage[short]{optidef}

\begin{document}

% The horizontal alignment works perfectly with mini* ...
\begin{mini*}
	{}{x}
	{}{}
	\addConstraint{x}{\geq \sqrt{\hat{\sigma}^2+t_2}\sqrt{\frac{1-\epsilon}{\epsilon}} + \hat{\mu} + t_1 + \sqrt{\hat{\sigma}^2+r_2}\sqrt{3\Psi^{-1}_{\text{beta}}(1-2\epsilon)} + \hat{\mu} + r_1}
\end{mini*}

% ... but there's a problem with the referenced mini version of the same problem.
\begin{mini}
	{}{x}
	{\label{eq:1}}{}
	\addConstraint{x}{\geq \sqrt{\hat{\sigma}^2+t_2}\sqrt{\frac{1-\epsilon}{\epsilon}} + \hat{\mu} + t_1 + \sqrt{\hat{\sigma}^2+r_2}\sqrt{3\Psi^{-1}_{\text{beta}}(1-2\epsilon)} + \hat{\mu} + r_1}
\end{mini}

\end{document}

Clash between the mini! enviroment of optidef and the babel package

First i' like to thank you for this nice package! it really helps when having complicated optimization problems to write.
However i have a small issue when using the {mini!} environment. When i try and compile, an error message is returned : \begin{mini!} on input line 174 ended by \end{mini!}. \end{mini!}.
The {mini} and {mini*} on the other hand work fine.
I am using the plain { article } class and no special referencing package. Do you have any idea that could help me. Thanks!
Here is a sample of the code:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsfonts,amssymb} 

\begin{document}

\begin{mini!}|l|[2]
	{\substack{\dot{u},\; \dot{\varepsilon}_{e},\; \dot{\varepsilon}_{p},\; \dot{\varepsilon}_{p,int},\\ \dot{\gamma},\; \dot{\gamma}_{int}}}
	{\sum_{q=1}^{N_{Gauss}} f(x)}
	{}{}
	\addConstraint{u_{q}^{(k)}+\dot{u}_{q}}{=\underline{u}_{q}^{(k)}+\underline{\dot{u}}_{q} \qquad} {q \in \Gamma_{\underline{u}}}

\end{document}

[Feature Request] \breakConstraint command

Hi,
first of all thank you for your work on this package, it's really useful!
I'm trying to write a really long constraint, and I'd like to split it in 2 lines.
I tried using \breakObjective, and it almost works but prints "subject to" again in the next line, which I'd like to avoid. I also tried implementing it by myself, but it's way too hard for a LaTeX noob like me (just started using it last week).
Would it be possible for you to do this, please?
If you are too busy it's no big deal, thanks anyway!

I attached a screenshot to show you an example of what I'm trying to achieve.
screenshot from 2019-02-27 19-49-32

[Feature Request] Customize alignments for objective and constraints

It would be very much appreciated if the developers can add an option to align the (potentially long) objective and constraints at a specific position. For example,

Screenshot_20210909_090348

looks better to me. Using \breakObjective only aligns the multirow objective to the left and may looks a little bit messy when the equal sign is involved:

Screenshot_20210909_084108

Thanks for your attention.

Environment: optidef 2019/04/23 - version=3.1

Crash when using more than z constraints

Hi again, sorry for disturbing.

Im running my optimization problem in the {mini!} enviroment. But the numeration system of the whole document crashes when I exceed the z constraint (e.g 4.36z). Is there any way to have more than 24 numbered constraints?

Thanks in advance

An indentation after using "maxi!" is forced

First, thank you for creating the "optidef" package.
The bug I want to report is about indenting (although there may be a problem with my usage).

\begin{maxi!}|l|[3]
	{x}
	{f(x) \protect\label{Prob:Obj}}
	{\label{Prob}}
	{}
	\addConstraint{g_j(x)}{\le 0,\protect\label{Const:Comm}}{\forall j=0,\ldots,M}
	\addConstraint{h_j(x)}{= 0,\protect\label{Const:Comm}}{\forall j=0,\ldots,N,}
\end{maxi!}
where $g_j$ and $h_j$ are blah blah blah.

In the above code, there is an indentation before "where". I remember that in previous versions there was no bug for this indentation. How should I solve it?

[bug] Extra space after \begin{mini} environment

After the minimize environment, I get an extra space at the beginning of the text following the environment, for example

\begin{mini!}
    {w \in \R^n}
    {f(w)}
    {\label{eq:convex}}
    {}
    \addConstraint{C w}{= \overline{c}}
    \addConstraint{w}{\in \Omega,}
\end{mini!}
where we define ...

which renders with an extra space,
screen shot 2016-10-19 at 13 27 58
when it should not.

Error when using cleveref

Hi,
I am using optidef and get an error when using \label commands in the mini! environment. I have found that this problem occurs as soon as I use the package cleveref. Here is some MWE:

\documentclass{article}

\usepackage[nocomma,short]{optidef}
\usepackage{cleveref}

\begin{document}

\begin{mini!}
{x}{\sum_{i = 1}^{n} y_i}{}{}
\addConstraint{y_i}{\leq t_i \label{test}\qquad }{ i \in {1,\dots,n}}
\end{mini!}

\end{document}

Commenting cleveref out resolves the issue.

mini! clashes with journal class / option [proc]edpsmath

Hi,
I am currently writing a paper using the class edpsmath with options edpsproc, as can be downloaded here: https://www.esaim-proc.org/author-information/latex2e-macro-package

This is somehow clashing with the mini! environment (mini and mini* work fine)

The error message is:

! LaTeX Error: \begin{mini!} on input line 7 ended by \end{mini!}.

It still produces a pdf though and typesets the optimization problem as intended.
Version of optidef is 3.1

MWE:

\documentclass[proc]{edpsmath}
\usepackage{optidef}
\begin{document}
\begin{mini!}
	{}{f(x)}
	{}{}
	\addConstraint{g(x)}{= 0}
\end{mini!}
\end{document}

Do you have any idea of a quick fix? Thanks!

Optidef Find Environment

Is it possible to add an environment for finding purely feasible solutions without an objective, e.g. "find x subject to..."?

Overlapping second and first alignment with constraint format 2

Hi,

I'm having an issue when trying to use extra alignments with format 2. They go after all the longest equations (in my case, the two first constraints). Do these extra alignments just work with the format 0 ?

WRE:

\documentclass{article}
\usepackage{optidef}
\begin{document}
\begin{mini*}[2]
{X}{\mathrm{OBJ}(X)}{}{}
\addConstraint{F_{1}(X)}{\ge \mathrm{\Delta }_{1} F_{1}(X_0)}
\addConstraint{F_{2}(X)}{\ge \mathrm{\Delta }_{2} F_{2}(X_0)}
\addConstraint{\sum_{j\in R}{x_{i,j}}}{=1,\quad}{\forall i\in P}
\addConstraint{\sum_{k\in H}{y_{k}}}{=1}
\addConstraint{x_{i,j}}{\in \{0,1\},\quad}{\forall i\in P, j\in R}
\addConstraint{y_{k}}{\in \{0,1\},\quad}{\forall k\in H}
\end{mini*}
\end{document}

Thanks

Standalone documentclass gives errors

Please extend support for standalone documentclass.
It currently gives errors.
I'm using TeX Live 2018 on Debian 10 Stable.

Below is the sample code that I used, which works well in article but not in standalone.

% \documentclass{standalone}
\documentclass{article}
\usepackage{optidef} %for optimization problems
\begin{document}
\begin{mini*}
{x}{ f (x)}{}{}
\addConstraint{x}{\le 9}{}
\addConstraint {x}{\ge 0}{}
\end{mini*}
\end{document}

Alignment Problem with breakObjective

When having a long list of optimization variables, the second half of the objective function as set via \breakObjective{} is not aligned with the first part of the objective.

Here a MWE:

\documentclass{article}


\usepackage{amsmath,optidef}
\begin{document}
	\begin{argmini!}
		{w,uasdasssssssss}{f(w)+ R(w+6x)+ H(100w-x*w/500)}{}{}
		\breakObjective{-g(w^3-x^2*200+10000*w^5)}
		\addConstraint{g(w_k)+h(w_k)}{=0,}{k=0,\ldots,N-1}
		\addConstraint{l(w_k)}{=5u,\quad}{k=0,\ldots,N-1}
	\end{argmini!}
\end{document}

optidef

I would have wished/expected them to be aligned at the red bar I added.

Error using class file of Wiley journal OCAM

First of all, thank you for this great and useful LaTeX package!

I am currently writing a paper which I want to submit to the Wiley journal Optimal Control Applications and Methods (OCAM). They use a special class file
It seems that using both optidef and this class file causes the following two errors while compiling:

Argument of \env@new has an extra }. \end{document}
Paragraph ended before \env@new was complete. \end{document}

A minimal example that produces this error is given by

\documentclass[AMA,STIX1COL]{WileyNJD-v2}
\usepackage{optidef}

\begin{document}
	This is some text \cite{article01}
	
	\begin{mini!}{x}{f(x)}{\label{mylabel}}{}
		\addConstraint{g(x)}{\le 0}
		\addConstraint{h(x)}{= 0}
	\end{mini!}

	\bibliographystyle{plain}
	\bibliography{miniLiterature}
\end{document}

where the miniLiterature.bib file is just a small bib file with

@article{article01,
    author = {surname familyname},	
    title = {title},
    journal = {journal},
    year = {2000},
    volume = {volume},
    number = {number}, 
    pages = {pages}, 
    month = {month}, 
    note = {note},
}

[FeatureRequest] Automatic labeling

Just from the top of my head, I had the following idea for automatic labeling of the optimization problem:
At least for me, it is often the case that I use the following labeling scheme

  • The overall problem gets e.g. \label{eq:xxx:yyy} where xxx denotes the e.g. the section or chapter and yyy the name of the optimization problem.
  • Then the objective gets \label{eq:xxx:yyy:obj}
  • For the contraints I see two options:
    -- Numbering ala \label{eq:xxx:yyy:c1}, \label{eq:xxx:yyy:c2}, ...
    -- Naming ala \label{eq:xxx:yyy:zzz} where zzz describes what that constraint is about.

I could image that an additional option e.g. to the mini! environment could take a name (such as yyy in the above case) and then the naming is done automatically in case of the numbering scheme (first option above) or the objective/constraints also get a naming option where one could provide e.g. zzz from the second case above.

What do you think?

Incorrect indent after argmini!

There is an incorrect indentation of the text following a argmini! environment.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[short]{optidef}

\begin{document}
	
The optimization problem is defined as
\begin{argmini!}
	% Optimization variable
	{R,L_{\beta},\beta}
	% Objective function
	{\frac{\left\lVert Z_{\text{FRAC}}(R,L_{\beta},\beta,\omega) - Z_{\text{FEA}}(\omega)\right\rVert^{2}}{\left\lVert Z_{\text{FEA}}(\omega)\right\rVert^{2}} \label{eq:objectiveFunction}}
	% Optimization problem label
	{\label{eq:optimizationProblem}}
	% Optimization results
	{}
	% Constraints
	\addConstraint{R}{> 0, \quad R &&\in \mathbb{R}}
	\addConstraint{L_{\beta}}{> 0, \quad L_{\beta} &&\in \mathbb{R}}
	\addConstraint{0 \leq \beta}{\leq 1, \quad \beta &&\in \mathbb{R} \label{eq:betaConstraint}}
\end{argmini!}
where $Z_{\text{FRAC}}(R,L_{\beta},\beta,\omega)$ is the impedance calculated from the fractional model  and $Z_{\text{FEA}}(\omega)$ is the impedance determined by FEA.

\end{document}

Extra alignment issue

Hi,

when i am using the extra alignment feature the equation (number) jumps to the next line even though there is still enough space on the line.

I am using the constraint style 2 and the nocomma paramenter when importing the package.

Thanks for all

Equation exceeds the width and page size

First of all, congrats and thank you for this wonderful tool! =)
I'm having trouble with my equations.
I have a mathematical model and I don't want to break it in many \begin{mini!} \end{mini!}, however I can't have a new page, as I wrote an equation it is hidden as the page is over. This also happens in the width of the page.

Thanks.

optidef messes with overbrace somehow

The following LaTex code

\documentclass{article}

\usepackage{amsmath}
\usepackage{mathabx}
\usepackage{optidef}

\begin{document}

\begin{equation*}
\overbrace{T + H + I + S \times U + N + D + E + R}^{\mathrm{top}}
\end{equation*}

\end{document}

results in

screen shot 2018-07-13 at 12 13 19

If I switch the lines \usepackage{mathabx} and \usepackage{optidef}, it returns the correct overbrace rendering:

screen shot 2018-07-13 at 12 14 28

Note that if I don't include amsmath, it does not even compile. ('command \iint already defined' etc). My guess is that somehow, optidef relies on amsmath and is unhappy with mathabx being included first.

customized tag required

Dear developer, thanks for your contribution! But now I have to type an optimization problem with a customized tag behind it, like (LP)/(NLP)/... etc, hope you can give me the introduction.

Space between contraints

Thank you for this answer. If I try that I would like to reduce the vertical space between the two constraints but normal commands as \vspace{-0.5pt} don't work. How can I achieved that? Thanks.

Originally posted by @AlfaimaSB in #26 (comment)

Setup for flexible international naming

I have just found out about your package. I really appreciate how you implemente the \addConstraint commands. I will start writing optimization problems soon, and your package was a delightful discovery.

On the other hand, I think there should be options to change key words, in a babel sense. The main concept is always enable change of word when language might be an issue.

Let me show a small contribution below.

MWE -- main file

\documentclass{article}
\usepackage{optidef}

% New word to substitute "subject~to"
%\TxtSubjectTo{}
\TxtSubjectTo{Potato}
\TxtMinTo{Carrot}

\begin{document}
\begin{mini}
  {w,b,\xi}{\frac{1}{2}w^{t}w+C\sum_{i=1}^{N}{\xi_{i}}}
  {}{}
  \addConstraint{y_{i}(w\phi(x_{i}+b))+\xi_{i}-1}
  \addConstraint{\xi\geq0}{}
\end{mini}
\end{document}

hange in optidef.sty before "% OBJECTIVE COMMAND DEFINITION"
I added:

\def\@TxtSubjectTo{subject~to}
\newcommand{\TxtSubjectTo}[1]{%  [subject~to]
  \gdef\@TxtSubjectTo{#1}
}

and replaced every instance of "subject~to" with "@TxtSubjectTo", and "minimize" with "@TxtMinTo" such as

\newcommand{\bodyobj}[4]{%
	\ifthenelse{\isempty{#4}}{%
		&\underset{\displaystyle #1}{\mathrlap{\mathrm{#3}}\phantom{\mathrm{\@TxtSubjectTo}}} \quad #2\span\span\span\span
	}{%
		#4~ &\underset{\displaystyle #1}{\mathrlap{\mathrm{#3}}\phantom{\mathrm{\@TxtSubjectTo}}} \quad #2\span\span\span\span
	}%
}

{\setFormatLong{minimize}{#4}\BaseMiniStar{#2}{#4}{#5}{#7}{\@TxtMinTo}{#3}}%

image

use optidef in 2 column mode

Hello,

I want to use optidef in 2 column mode, but the optimisation problem should spread over both columns. How does that work? Is there anything similar to \begin{table*}. Obvioulsy \begin{mini*} does bot work.

Thanks!
Matthias

Write constraints separately

Hi there!

I would like to know if there is a way to write just some constraints without having to add an objective function (and without the text: "subject to").

This could be useful for example for cases in which you explain the constraints separately in an article (for adding text and explanations from one constraint to another).

Thank you and congrats for the library, I find it so useful! :)

Italic font for "minimize" when using the package breqn

Hey, I found your LaTeX package and it is very useful! However, if I additionally use the package "breqn", the "minimize" is in italic font. Is there are work around for this?

\documentclass{article}

\usepackage{breqn}
\usepackage{optidef}
\begin{document}
\begin{mini}
	{x}{ \frac{1}{2}x^{\prime}Dx}{}{}
	\addConstraint{A^\prime x}{\geq b}{}
\end{mini}
\end{document}

grafik

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.