# How to avoid complementarity constraints in continuous nonlinear program?

In my two-stage continuous NLP problem, I have a constraint in second stage:

$$X_{g,k}$$ = $$X_{g,0} + a_{g} d_{g}$$, if $$X_{g,k} \in [X_g^u,X_g^l]$$

$$X_{g,k} = X_g^u$$, if $$X_{g,k} \geq X_g^u$$

$$X_{g,k} = X_g^l$$, if $$X_{g,k} \leq X_g^l$$

Here $$a_{g}$$ is a predefined factor between {0,1}, and $$d_{g}$$ is an unbounded variable. $$X_{g,0}$$ is a first-stage value of variable $$X_{g,k}$$. It can be implemented using two binary variables but I want to keep the problem continues for efficient computation. How can I handle such constraints?
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 11, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.745479166507721, "perplexity": 448.24614476963825}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2023-14/segments/1679296945433.92/warc/CC-MAIN-20230326044821-20230326074821-00282.warc.gz"}